Ticket #1693 (closed bug: fixed)

Opened 11 months ago

Last modified 11 months ago

TCP sockets not cleaned up correctly

Reported by: mjw Owned by: axeld
Priority: normal Milestone: R1/alpha1
Component: Network & Internet/TCP Version: R1 development
Cc: Blocked By:
Platform: All Blocking:

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 r23220 under qemu.

Attachments

sock_close_test.tgz (0.8 kB) - added by mjw 11 months ago.

Change History

Changed 11 months ago by mjw

Changed 11 months ago by axeld

  • status changed from new to assigned
  • component changed from - Network & Internet/Stack to - Network & Internet/TCP

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.

Changed 11 months ago by axeld

  • milestone changed from R1 to R1/alpha

Changed 11 months ago by axeld

  • status changed from assigned to closed
  • resolution set to fixed

Fixed in r23251.

Note: See TracTickets for help on using tickets.