TIME_WAIT sockets clog system

David L Stevens dls at mace.cc.purdue.edu
Wed Jul 5 00:35:18 AEST 1989


In article <33437 at wlbr.IMSD.CONTEL.COM>, sms at wlv.imsd.contel.com (Steven M. Schultz) writes:
> 	it would be enlightening to know why sockets stay around so long
> 	in a TIME_WAIT state (especially on a LAN) and what would break
> 	if the timeout interval were reduced.

	Since TCP works on top of IP, in theory, anyway, it can't tell the
difference between a LAN and a 5-hop internet connection. The timeout is
(perhaps unfortunately) fixed at 2*(Maximum Segment Lifetime) with no
assumptions about the connection.
	One bad thing that can happen if you timeout too fast is that, if
the ACK to the remote guy's FIN is dropped, you won't be there to ACK his
retransmission and he'll be stuck in LAST_ACK. On pre-tahoe (maybe pre-4.3--
too many distributions!) systems, that wait is forever; current BSD code
times out of LAST_ACK. Non BSD, RFC-793 conforming code will still wait
forever.
	Another way of handling this is to free all of the resources except
a stub PCB with just the basic info. Pretty much the only function of a
TIME_WAIT state endpoint is to re-ACK retransmitted FINs.
	Yet another way, not to TCP spec but in the right spirit, is to
make the TIME_WAIT interval a function of the srt. On fast connections,
it'd go away quicker. 2*MSL is the absolute worst case, which probably
never happens.
-- 
					+-DLS  (dls at mace.cc.purdue.edu)



More information about the Comp.bugs.4bsd.ucb-fixes mailing list