Subject: Re: FIN_WAIT_2's remaining in connection list
To: Ryan Younce <firstname.lastname@example.org>
From: Bill Sommerfeld <email@example.com>
Date: 10/22/2000 18:46:53
> I was perusing the FreeBSD bugs report page and discovered a bug marked
> serious in which connections to a remote Netware web server (and then
> closing the connection) would cause the connection to remain in the
> FIN_WAIT_2 state for several days. The submitter indicated that he had
> run a script to open several thousand connections, and they all remained
> in the list for several days before being cleared out.
Be careful. FIN_WAIT_2 is a (potentially) long-term stable state in
TCP (when one direction has closed and the other hasn't); simply
deleting connections which have been in FIN_WAIT_2 state for 2*MSL may
cause data loss, because the connection is still actually open in the
inbound direction at that point!
See the state diagrams and such in RFC793 (the TCP spec) before
playing with the FSM in the implementation..
In practice, if the local process has completely closed the connection
(so any future received data will be bitbucketed) there's not going to
be any data loss so it's likely to be OK to transition an idle
connection into TIME_WAIT after trying several times to provoke a
response with keepalive probes; but if it's still open for read, it
would be incorrect to blow away the connection.
If this sort of thing is a problem in practice, you may want to adjust
the values for the keepalive timers..