netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Miller <davem@davemloft.net>
To: johnpol@2ka.mipt.ru
Cc: shemminger@linux-foundation.org, netdev@vger.kernel.org
Subject: Re: [Bug 8013] New: select for write hangs on a socket after write returned ECONNRESET
Date: Thu, 22 Feb 2007 06:08:05 -0800 (PST)	[thread overview]
Message-ID: <20070222.060805.59465933.davem@davemloft.net> (raw)
In-Reply-To: <20070222134620.GC5208@2ka.mipt.ru>

From: Evgeniy Polyakov <johnpol@2ka.mipt.ru>
Date: Thu, 22 Feb 2007 16:46:21 +0300

> On Thu, Feb 22, 2007 at 05:31:38AM -0800, David Miller (davem@davemloft.net) wrote:
> > TCP_CLOSE is where we end up on a non-error close too, this has
> > the same kind of bug as your previous attempt to set POLLERR
> > here.
> > 
> > One side gets TCP_TIMEWAIT the other goes straight to TCP_CLOSE.
> > 
> > It really is not possible to change current semantics, they are the
> > best possible unfortunately.
> 
> AS a last attempt - we can have a sockt flag set when sk-err is
> installed in tcp_reset(), and tcp_poll() will set POLLERR if that flag
> exist (just like it checks for sk_err, which is cleared in tcp_sendmsg()
> when error is being returned).

Oh is that the problem?  Someone sees a fatal connection error from
write() then attempts to poll() the socket?

That is illegal.

Socket is dead, you cannot do anything reasonable with it and you know
the socket is errored so there is nothing you can possibly try to
poll() on it for.

One should close() the file descriptor at this point.  Even
getpeername() cannot work at this point, since socket is closed and
has lost identity.

Socket errors are delivered as unique events, once error is delivered
the socket is not in error state any more, it is instead closed.
That's why we clear sk->sk_err after error delivery.

BTW, there was a query about this back in Feb. 2006 on linux-kernel,
nobody replied, he reposted to linux-net in September 2006 and this
is likely where this kernel bugzilla comes from :-)

This is not a kernel bug, let's close this and move on.

  reply	other threads:[~2007-02-22 14:08 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-02-16  0:04 Fw: [Bug 8013] New: select for write hangs on a socket after write returned ECONNRESET Stephen Hemminger
2007-02-16 15:25 ` Evgeniy Polyakov
2007-02-16 15:28   ` Evgeniy Polyakov
2007-02-16 15:39     ` Evgeniy Polyakov
2007-02-16 15:54       ` Evgeniy Polyakov
2007-02-16 16:10         ` Evgeniy Polyakov
2007-02-16 18:29           ` Stephen Hemminger
2007-02-16 18:34             ` Evgeniy Polyakov
2007-02-17 16:25               ` Evgeniy Polyakov
2007-02-19 14:19                 ` Jarek Poplawski
2007-02-22  6:47                 ` David Miller
2007-02-22  6:45               ` David Miller
2007-02-22 12:14                 ` Evgeniy Polyakov
2007-02-22 13:31                   ` David Miller
2007-02-22 13:46                     ` Evgeniy Polyakov
2007-02-22 14:08                       ` David Miller [this message]
2007-02-22 18:24                         ` Stephen Hemminger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070222.060805.59465933.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=johnpol@2ka.mipt.ru \
    --cc=netdev@vger.kernel.org \
    --cc=shemminger@linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).