From owner-freebsd-net@FreeBSD.ORG Sun Apr 4 14:54:55 2004 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id AA83216A4CE for ; Sun, 4 Apr 2004 14:54:55 -0700 (PDT) Received: from mail.sandvine.com (sandvine.com [199.243.201.138]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4792143D2D for ; Sun, 4 Apr 2004 14:54:55 -0700 (PDT) (envelope-from don@sandvine.com) Received: by mail.sandvine.com with Internet Mail Service (5.5.2657.72) id ; Sun, 4 Apr 2004 17:54:54 -0400 Message-ID: From: Don Bowman To: 'Brandon Erhart' , freebsd-net@freebsd.org Date: Sun, 4 Apr 2004 17:54:43 -0400 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2657.72) Content-Type: text/plain; charset="iso-8859-1" Subject: RE: FIN_WAIT_[1,2] and LAST_ACK X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 04 Apr 2004 21:54:55 -0000 From: Brandon Erhart [mailto:berhart@ErhartGroup.COM] > 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. > > 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 (tp->t_state != TCPS_TIME_WAIT && > > to > > if (tp->t_state < FIN_WAIT_2 && > > I also tried changing that to ".. <= FIN_WAIT_2 .." > > However, I still end up with quite a few stuck in FIN_WAIT_1, > FIN_WAIT_2 or > LAST_ACK after the program exits (and whilst the program is > running of > course). They don't seem to timeout in the same interval that > TIME_WAIT does. > > Any ideas? Did I modify the right piece of code? I was told > to post here as > you all would more than likely know! > Perhaps you want to lower net.inet.tcp.msl sysctl?