FIN_WAIT_[1,2] and LAST_ACK

Mike Silbersack silby at silby.com
Sun Apr 4 15:32:12 PDT 2004


On Sun, 4 Apr 2004, Brandon Erhart wrote:

> Hello everyone,
>
> I am writing a network application that mirrors a given website (such as a
> suped-up "wget"). I use a lot of FDs, and was getting connect() errors when
> I would run out of local_ip:local_port tuples. I lowered the MSL so that
> TIME_WAIT would timeout very quick (yes, I know, this is "bad", but I'm
> going for sheer speed here), and it alleviated the problem a bit.

In 5.2, I added code which automatically recycles TIME_WAIT sockets so
that this problem doesn't happen.  That's one possible solution that that
sub-problem, but as you've solved it with the msl change it's hardly a
large enough reason to change.

> However, I have run into a new problem. I am getting a good amount of
> blocks stuck in FIN_WAIT_1, FIN_WAIT_2 or LAST_ACK that stick around for a
> long while. I have been unable to find must information on a timeout for
> these states. I came across a small patch that modified tcp_timer.c in
> /usr/src/sys/netinet. It changed line #484 (in FreeBSD 4.9-REL) from:

If you can recreate this problem frequently, could you try capturing a
connection "hanging" with tcpdump?  Perhaps there is a problem in our TCP
state engine that needs to be fixed.

Mike "Silby" Silbersack


More information about the freebsd-net mailing list