From owner-freebsd-net@FreeBSD.ORG Mon Jun 25 18:02:07 2007 Return-Path: X-Original-To: freebsd-net@freebsd.org Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 40A8216A400 for ; Mon, 25 Jun 2007 18:02:07 +0000 (UTC) (envelope-from cswiger@mac.com) Received: from mail-out3.apple.com (mail-out3.apple.com [17.254.13.22]) by mx1.freebsd.org (Postfix) with ESMTP id 2695313C44B for ; Mon, 25 Jun 2007 18:02:07 +0000 (UTC) (envelope-from cswiger@mac.com) Received: from relay6.apple.com (relay6.apple.com [17.128.113.36]) by mail-out3.apple.com (Postfix) with ESMTP id 0D60AA33BCF; Mon, 25 Jun 2007 11:02:07 -0700 (PDT) Received: from relay6.apple.com (unknown [127.0.0.1]) by relay6.apple.com (Symantec Mail Security) with ESMTP id EB3EE10082; Mon, 25 Jun 2007 11:02:06 -0700 (PDT) X-AuditID: 11807124-a2ce2bb0000007e2-51-4680031e6cd0 Received: from [17.214.13.96] (int-si-a.apple.com [17.128.113.41]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by relay6.apple.com (Apple SCV relay) with ESMTP id D0EE310081; Mon, 25 Jun 2007 11:02:06 -0700 (PDT) In-Reply-To: <20070625174639.GC1221@funkthat.com> References: <467C727D.4060703@elischer.org> <20070626023944.M82078@besplex.bde.org> <467FF8BB.1040507@elischer.org> <20070625174639.GC1221@funkthat.com> Mime-Version: 1.0 (Apple Message framework v752.2) Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: <2DD749A4-FD3C-4B47-BD97-5C7A6421C811@mac.com> Content-Transfer-Encoding: 7bit From: Chuck Swiger Date: Mon, 25 Jun 2007 11:02:05 -0700 To: John-Mark Gurney X-Mailer: Apple Mail (2.752.2) X-Brightmail-Tracker: AAAAAA== Cc: FreeBSD Net , Julian Elischer Subject: Re: [6.x] problem with AIO, non-blocking sockets on freebSD and IE7 on windows. X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 Jun 2007 18:02:07 -0000 On Jun 25, 2007, at 10:46 AM, John-Mark Gurney wrote: >> It's not the correct behaviour if the only packet coming back is >> an Ack of >> the FIN (and a FIN) because in the real world, making IE7 throw an >> error >> screen is not an acceptable option. This is the sort of thing >> that gets FreeBSD thrown out on favour of "anything else". >> Believe me, our customers are "NOT HAPPY" about this. >> Instead of getting an "authorization required" page along with >> the opportunity to log in, they get an error, and no opportunity >> to log in, which makes the system unusable. >> Yes, Blame Microsoft, but we are breaking the TCP spec, not them. >> We need to fix this some how. > > As bde mention, the bug is in the application... Even SUSv2 says: > When all file descriptors associated with a pipe or FIFO special > file are closed, any data remaining in the pipe or FIFO will be > discarded. A TCP socket isn't the same thing as a named pape or FIFO. SUSv2 isn't the most relevant standard; RFC-793 is... > Our own close(2) says: > on the last > close of a socket(2) associated naming information and queued > data are > discarded > > So, failure of the application to ensure that all data is sent is the > application's fault... bde alluded to a simple work around of > clearing > the non-blocking flag which will return close to the "expected" (but > apprently broken) behavior of keeping the tcp socket around till all > remaining data has been sent... > > I must note that the code you quoted has been in FreeBSD since 2.0. ...and the relevant part is section 3.5 (circa pg 37) and the TCP state diagram on pg 23. Using non-blocking I/O does not mean one can suddenly shortcut the FINWAIT-1 and FINWAIT-2 states before going into TIME_WAIT, nor the 2 * MSL timeout before the TCP control block is allowed to go away. Otherwise, you might end up sending a RST to a dup'ed packet like a stray ACK, which seems to be almost exactly the problem at hand. -- -Chuck