Re: TCP hangs in 2.4 - blocking write() in wait_for_tcp_memory

Miquel van Smoorenburg (miquels@cistron.nl)
Wed, 30 Oct 2002 10:44:20 +0000 (UTC)


In article <apme9u$n2n$1@ncc1701.cistron.net>,
Miquel van Smoorenburg <miquels@cistron.nl> wrote:
>On the gateway machine, the proxy consistantly hangs in a write().
>I've replaced the squid proxy with a simple perl script + nc to
>make sure it isn't a squid-related problem..

Right, I found the cause of the problem, but I'm not sure if the
application of the kernel is wrong here.

On 2 machines do this:

machine1# socket -s 12345 < /dev/zero > /dev/null # server
machine2# socket -w machine1 12345 < /dev/zero # client

The first command starts a listening process on port 12345, that
sends an infinite stream of zeros to the remote side and sinks
all data received.

The second command connects to the first machine, sends an
infinite stream of zeros, but never does a read() on the socket
(the '-w' option).

The 'socket' program doesn't make the sockets non-blocking, it just
does a select() loop to find out readability/writeability on the
file descriptors.

This makes both socket programs hang in write(), in wait_for_tcp_memory.
Shouldn't the kernel return a short write, instead of hanging
both processes ? select() returned writeability.

As I described in my first mail, this happens in the real world
as well - an application is writing lots of data to the remote
side, while the remote side is sending data too - hang.

Oh, tested it on 2.4.19 and 2.4.20-pre11

Mike.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/