Possible TCP socket bug in kernel >= 2.2.15pre2 and recent 2.3

From: Martin Josefsson (gandalf@wlug.westbo.se)
Date: Mon Mar 20 2000 - 17:04:16 EST


Hi

I've encountered something that I strongly think is a bug.

The program that i noticed this with is distmp3 (perl).

The client opens a tcp connection to the server.
The client opens a wav-file and starts sending the data to the server.
The server recieves the data and passes it to a mp3enconder that encodes
the data and sends it back to the client.

the client sends data until there is nothing left in the wav-file, then it
runs a:

shutdown $socket,1;

DESCRIPTION
       The shutdown call causes all or part of a full-duplex con­
       nection on the socket associated with s to be shut down.
       If how is 0, further receives will be disallowed. If how
       is 1, further sends will be disallowed. If how is 2, fur­
       ther sends and receives will be disallowed.

(man 2 shutdown, it's for C but it's the same for perl)

When the client runs this on the socket the server should understand that
it cant read more data from the socket (the servers socket, not the
clients socket)

the server runs a:

while ( read $remote_client,$data,$DATA_SIZE ) {
        do something with $data here
}
close named-pipe that mp3encoder uses as wav-input

the server understands this and the while-loop stops when the client has
run shutdown $socket,1;

the problem is that when the mp3encoder has closed the named-pipe
(named-pipes are used to communicate with the mp3encoder) the server sends
a shutdown $remote_client,1;

but the client never understands this, the client has a similar loop that
waits for data to be written down to a file.

all this works perfectly in 2.0.x and 2.2.x where x is below 2.2.15pre2
it works in 2.2.15pre1

it doesn't work in 2.3.99pre2 or 2.3.99pre2-5 or 2.3.47

however there is a diffrence between 2.2.15pre2+ and 2.3.99pre2
in 2.2.15pre2+ the client just sits there and listens for more data.

in 2.3.99pre2 the client writes a lot of data to the mp3file when it
should realize that the server has closed the connection for writing
(which means that the client should not be able to read from it).
in 10secs the file became 220MB.
My harddrive was maximized, the system became almost unusable.

As it has worked in 2.0.x and the official 2.2.x (haven't tested them all)
I think this is a bug that needs to be fixed.

If anyone wants more info I'll supply that
If anyone has a patch that he/she wants me to test, I'll do that

/Martin

-- 
The three best things about going to school are June, July, and August.

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



This archive was generated by hypermail 2b29 : Thu Mar 23 2000 - 21:00:31 EST