[6.x] problem with AIO, non-blocking sockets on freebSD and IE7 on windows.

Chuck Swiger cswiger at mac.com
Mon Jun 25 18:02:07 UTC 2007


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



More information about the freebsd-net mailing list