[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Possible fix for tcp-connect under Linux 2.4



A while back I mentioned a problem I was having involving Linux
2.4.0-test6 and MzScheme 102's tcp-connect function. Apparently some
change in the kernel was causing tcp-connect to fail with a
less-than-helpful error message.

I traced the tcp-connect failure to the following code (in network.c,
tcp_connect):

#ifdef USE_UNIX_SOCKETS_TCP
            status = recv(s, NULL, 0, 0); /* test input */
            if (!status)
              status = send(s, NULL, 0, 0); /* test output */

I'm guessing this is just intended as an extra sanity check, but I
suspect that zero-byte network operations are open to interpretation,
especially when it comes to detecting the zero-size situation and not
trying to queue a send or receive. No, it SHOULDN'T block (or return an
error for async sockets), but I think that is what's happening, probably
due to the recent (err, perpetual) hacking on the network code in the
Linux kernel. The recv seems to cause a "resource temporarily
unavailable" error, which causes tcp_connect to fail even though it's
not a critical problem.

I added a bunch of diagnostic messages and forced status to zero
immediately after this code, and everything seems to work now. I tested
it by loading http://slashdot.org in Help Desk (obviously the formatting
was a bit strange, but it worked).
 
-John