*BSD News Article 69433


Return to BSD News archive

Path: euryale.cc.adfa.oz.au!newshost.anu.edu.au!harbinger.cc.monash.edu.au!news.mira.net.au!inquo!bofh.dot!vyzynz!bofh.dot!newsfeed.concentric.net!news.texas.net!news1.best.com!nntp1.best.com!flash.noc.best.net!not-for-mail
From: dillon@best.com (Matthew Dillon)
Newsgroups: comp.unix.bsd.misc,comp.unix.sys5.r4
Subject: Re: TCP socket close() behavior (Was: Imcomplete Documents and Images from httpd)
Date: 25 May 1996 20:23:07 -0700
Organization: Best Internet Communications, Inc. (info@best.com)
Lines: 49
Distribution: world
Message-ID: <4o8iqr$25h@flash.noc.best.net>
References: <4m7r3m$9qt@nntpb.cb.att.com> <319b6555@yoda.omnicron.com> <4nkuav$q54@noao.edu> <31a1f624@yoda.omnicron.com>
NNTP-Posting-Host: flash.noc.best.net
Xref: euryale.cc.adfa.oz.au comp.unix.bsd.misc:1109 comp.unix.sys5.r4:11015

:In article <31a1f624@yoda.omnicron.com>,
:Mike "Ford" Ditto <ford@omnicron.com> wrote:
:>I am moving this thread to comp.unix.bsd.misc and comp.unix.sys5.r4
:>since it has come down to a question of sockets semantics.
:>
:>I submit for discussion the question of whether the kernel must attempt
:>to deliver pending sent data when a close() is performed on a connected
:>TCP socket without the SO_LINGER option enabled.
:>
:>I and a few other people wrote about a problem with several httpd
:>packages on various SVR4 systems.  I tracked the problem down to what I
:>declared to be a bug in the httpd software.  Both NCSA httpd 1.5.1 and
:>apache 1.0.3 have this "bug".

    Good god, you can't be serious ?  

    The write()/close() semantics are clear:  Buffering is normally
    an 'invisible' operation.  In general, if you do a write() followed
    by a close(), any operating system that decides to throw away some
    or all of the written data based on a window of opportunity (e.g.
    'oh no! he called 'close' too soon!' is a BROKEN operating system,
    Period.  It's broken no matter what your manual says.

    If you are running a system that junks pending buffered data
    for a TCP connection on close(), I suggest you throw it away,
    move to a more modern operating system, and be done with it.

    *Nobody* is going to rewrite the tens of thousands of close()
    system calls in the tens of thousands pieces of free software
    to 'fix' the (non)problem, so it's no use arguing about it.

    SO_LINGER is a broken option... it always has been.  Nobody uses
    it other then to, in some cases, make sure it is off.  The reason
    people do not use it is because it makes no transactional guarentees...
    sure, the data made it to the other end, but that doesn't mean the
    *process* on the other end read it!  I.E. it's a mostly useless
    feature.  Even fewer operating systems support a flush result code from
    close(), which makes it even more useless.

					    -Matt

:>
:>					-=] Ford [=-
:>
:>"But everybody wants a rock		(In Real Life:  Mike Ditto)
:> to wind a piece of string around."	ford@omnicron.com
:> - They Might be Giants, "We want a rock"