Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 09 Jun 2010 13:43:10 +0300
From:      Mikolaj Golub <to.my.trociny@gmail.com>
To:        Kostik Belousov <kostikbel@gmail.com>
Cc:        freebsd-hackers@freebsd.org, tss@iki.fi, perryh@pluto.rain.com
Subject:   Re: close() failing with ECONNRESET
Message-ID:  <86vd9s32rl.fsf@zhuzha.ua1>
In-Reply-To: <20100609094552.GE83316@deviant.kiev.zoral.com.ua> (Kostik Belousov's message of "Wed, 9 Jun 2010 12:45:52 %2B0300")
References:  <1276001507.6691.388.camel@kurkku.sapo.corppt.com> <4c0f442f.N55MZNOTsFpdxLGx%perryh@pluto.rain.com> <20100609094552.GE83316@deviant.kiev.zoral.com.ua>

next in thread | previous in thread | raw e-mail | index | archive | help

On Wed, 9 Jun 2010 12:45:52 +0300 Kostik Belousov wrote:

 KB> On Wed, Jun 09, 2010 at 12:35:11AM -0700, perryh@pluto.rain.com wrote:
 >> Timo Sirainen <tss@iki.fi> wrote:
 >> 
 >> > I see that since FreeBSD 6.3 close() can fail with:
 >> >
 >> > > [ECONNRESET]        The underlying object was a stream socket that was
 >> > >                 shut down by the peer before all pending data was
 >> > >                 delivered.
 >> >
 >> > Could someone explain what this is useful for?
 KB> Note that any return from close(2) that does not set errno to EBADF
 KB> closes the supplied file descriptor. Mentioned errno value supplies
 KB> caller with the information that not "all pending data was delivered".

We have kern/146845 about close(2) returning ECONNRESET for tcp
connections. Looking at the code (which I am not very familiar with though)
and running some tests make me think that currently ECONNRESET may be only
returned by close(2) after shutdown()/close() on our side and simultaneous
close() on the other side (and in this case this is wrong).

-- 
Mikolaj Golub



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?86vd9s32rl.fsf>