Re: Socket termination problem

Andi Kleen (ak@muc.de)
26 Mar 1999 16:25:31 +0100


laurila@bore.fysik.lu.se (Henrik Laurila) writes:

> I have experienced problems with terminations of TCP-sockets.
>
> 1) My side is actively sending a large amount of data to a rather
> slow peer.
>
> 2) The peer suddenly dies.
>
> 3) The socket-state becomes CLOSE_WAIT, and will stay so until the
> sending process is killed.

This is correct. CLOSE_WAIT means it waits for a close() from the
application, and a kill closes all open file descriptors.
Fix: call close() at the right time in your app.

>
> 4) If the sending process is killed, the socket-state will turn into
> LAST_ACK, and will stay so "forever".
>
> 5) This "forever", might sometimes only last for a few weeks or months.

This should not happen. What does netstat -t --timers output for such a
socket?

LAST-ACK means that it is waiting for the ack of the FIN just send.
If it does not appear the socket should be destroyed via a timer
after some time. When the other end retransmits packets (e.g. its FIN)
it is possible that the timer is always restarted. So what OS is the
peer running?

Is there any activity still on the connection (check with tcpdump) ?

-Andi

-- 
This is like TV. I don't like TV.

- 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/