Opened 17 years ago
Closed 17 years ago
#1693 closed bug (fixed)
TCP sockets not cleaned up correctly
Reported by: | mjw | Owned by: | axeld |
---|---|---|---|
Priority: | normal | Milestone: | R1/alpha1 |
Component: | Network & Internet/TCP | Version: | R1/pre-alpha1 |
Keywords: | Cc: | ||
Blocked By: | Blocking: | ||
Platform: | All |
Description
Consider two processes: a server and a client. If the server dies or exits gracefully when there is still data in the server socket's receive queue, then neither the server or client's sockets get cleaned up correctly by the OS.
To reproduce, I have created two example programs, a server and a client. The server waits for a connection, then reads 100 bytes, waits for a second, then exits. The client attaches to the server, sends 100 * 100 bytes, waits 10 seconds, then exits.
After the processes have finished, Running netstat shows that the server's socket has got 9900 bytes in the recv queue, and the socket goes into the time-wait state. The client's socket goes into the closed state with 0 bytes in both the send and recv queues. Running netstat repeatedly for some time shows that the sockets never get cleaned up.
I am not a real TCP expert, but I would imagine that these sockets would disappear from the netstat output after about 2 minutes.
The attached test case includes 2 .c files, and a Jamfile which assumes that the .c files are copied into $HAIKU/src/apps/sock_close_test.
I am running Haiku hrev23220 under qemu.
Attachments (1)
Change History (4)
by , 17 years ago
Attachment: | sock_close_test.tgz added |
---|
comment:1 by , 17 years ago
Component: | - Network & Internet/Stack → - Network & Internet/TCP |
---|---|
Status: | new → assigned |
comment:2 by , 17 years ago
Milestone: | R1 → R1/alpha |
---|
Nice catch - according to the sources, the sockets should indeed close down after 2 minutes (which is 2 times TCP_MAX_SEGMENT_LIFETIME). I'll have a look.