public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: David Schwartz <davids@webmaster.com>
To: <davem@redhat.com>, <niemayer@isg.de>
Cc: <linux-kernel@vger.kernel.org>
Subject: Re: read/recv sometimes returns EAGAIN instead of EINTR on SMP machines
Date: Tue, 23 Jul 2002 01:12:56 -0700	[thread overview]
Message-ID: <20020723081257.AAA26793@shell.webmaster.com@whenever> (raw)
In-Reply-To: <20020722.195749.34129476.davem@redhat.com>


On Mon, 22 Jul 2002 19:57:49 -0700 (PDT), David S. Miller wrote:
>From: Peter Niemayer <niemayer@isg.de>
>Date: Mon, 22 Jul 2002 12:43:14 +0200

>If one process tries to read non-blocking from a tcp socket (domain sockets
>work
>fine), and another process sends the reading process signals, then
>sometimes
>select() returns with the indication that the socket is readable,
>but the subsequent read returns EAGAIN - instead of EINTR which
>would have been the correct return code. This only happenes on SMP
>machines.

>I think EAGAIN is the correct return value.  This behavior has been
>there since the stone ages of TCP and I remember Alan specifically
>auditing all of this stuff long ago wrt. POSIX compliance.

	EAGAIN is the correct value unless the read/recv was itself interrupted by a 
signal. However, the 'select' should not indicate that the socket is readable 
unless there is something to read (or an error, or whatnot). When 'select' is 
interrupted by a signal, select should return EINTR.

	My guess is that select did return EINTR, but for some reason your 
application examined the fd sets anyway. So the bug is in not ignoring the fd 
sets when select returns an error, which is an application issue.

	Most likely, 'select' never got around to touching the fd sets at all.

	DS



  parent reply	other threads:[~2002-07-23  8:09 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-07-22 10:43 read/recv sometimes returns EAGAIN instead of EINTR on SMP machines Peter Niemayer
2002-07-23  2:57 ` David S. Miller
2002-07-23  3:56   ` read/recv sometimes returns EAGAIN instead of EINTR on SMP kuznet
2002-07-23  1:04     ` Arnaldo Carvalho de Melo
2002-07-23  6:12       ` James Morris
2002-07-23  8:12   ` David Schwartz [this message]
2002-07-23 10:14     ` read/recv sometimes returns EAGAIN instead of EINTR on SMP machines Peter Niemayer
2002-07-23 10:16   ` read/recv sometimes returns EAGAIN instead of EINTR on SMPmachines Peter Niemayer

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=20020723081257.AAA26793@shell.webmaster.com@whenever \
    --to=davids@webmaster.com \
    --cc=davem@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=niemayer@isg.de \
    /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