From owner-freebsd-current Mon May 19 10:04:25 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.5/8.8.5) id KAA03920 for current-outgoing; Mon, 19 May 1997 10:04:25 -0700 (PDT) Received: from phaeton.artisoft.com (phaeton.Artisoft.COM [198.17.250.50]) by hub.freebsd.org (8.8.5/8.8.5) with SMTP id KAA03915 for ; Mon, 19 May 1997 10:04:22 -0700 (PDT) Received: (from terry@localhost) by phaeton.artisoft.com (8.6.11/8.6.9) id JAA24391; Mon, 19 May 1997 09:54:37 -0700 From: Terry Lambert Message-Id: <199705191654.JAA24391@phaeton.artisoft.com> Subject: Re: FIN_WAIT_2 To: randy@zyzzyva.com (Randy Terbush) Date: Mon, 19 May 1997 09:54:37 -0700 (MST) Cc: dev@flevel.co.uk, dg@root.com, freebsd-current@FreeBSD.ORG In-Reply-To: <199705191323.IAA09358@sierra.zyzzyva.com> from "Randy Terbush" at May 19, 97 08:23:29 am X-Mailer: ELM [version 2.4 PL24] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-current@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk > > Thanks for the information. It seems from testing on one of our machines > > that the timeout may be around 5 mins. It's unfortunate that apache seems > > to have no way to detect that the user has hit stop other than just > > leaving the conntion in FIN_WAIT_2 until the kernel times it out. > > The Apache Group has gone through considerable contortions on this > issue. The FIN_WAIT_2 is not a result of a user pressing STOP, but > rather the result of a half-close on the socket waiting for the > client to either close or restart the connection. The are a number > of reasons that this is needed. Visit the following URL for a more > thorough explanation. > > > http://www.apache.org/docs/misc/fin_wait_2.html If you are a Winsock application programmer, it is important that you explicitly call shutdown( s, x), where x is (preferrably) 2. Otherwise, WinSock does not correctly negotiate shutdown on close. Winsock being broken is the major reason for these eternally hanging connections. Comes from people like NetScape and the people who wrote the code which became MS IE not understanding Winsock fully (what with them being decent, God-fearing UNIX folks, like your good neighbors). For more details: _Windows Sockets Network Programmiong_ Bob Quinn, David Shute Addison-Wesley Publishing ISBN 0-201-63372-8 Specifically, the end of "Chapter 4: Network Application Mechanics". The "x = 2" is required because some existing WinSock implementations fail to shutdown correctly with "x = 1". Regards, Terry Lambert terry@lambert.org --- Any opinions in this posting are my own and not those of my present or previous employers.