From: Mark Mielke <mark@mark.mielke.cc>
To: David Schwartz <davids@webmaster.com>
Cc: "Linux-Kernel@Vger. Kernel. Org" <linux-kernel@vger.kernel.org>
Subject: Re: UDP recvmsg blocks after select(), 2.6 bug?
Date: Fri, 15 Oct 2004 22:35:37 -0400 [thread overview]
Message-ID: <20041016023537.GA17023@mark.mielke.cc> (raw)
In-Reply-To: <MDEHLPKNGKAHNMBLJOLKAEKCPAAA.davids@webmaster.com>
On Fri, Oct 15, 2004 at 04:33:40PM -0700, David Schwartz wrote:
> I think it's a really bad idea to make 'select' more complicated by trying
> to nail down precise semantics for every possible protocol. The 'select'
> function is supposed to be protocol-neutral and trying to say it guarantees
> X on protocol Y, where such guarantees constrict what the kernel can do and
> do not make user code anything but more fragile, doesn't seem to be a good
> idea to me.
Are you saying that a minimal operating system should feel free to implement
select() to always return true with all bits set?
> For UDP specifically, datagrams are fundamentally discardable whenever that
> seems to be a good idea. In general, there are any number of corner cases
> for various combinations of protocols and situations where a 'select' hit
> will not be followed by an operation that doesn't block.
Like?
In the accept() case, you genuinely have a 'if you had substituted the
select() with an accept(), the accept() would have succeeded.'
In the UDP case, you do NOT have this situation. A recvmesg() in place
of select() would block, therefore, select() should not block.
> It just happens to be that 'select' works best when it's a hint that
> something has changed and the operation can/should be re-tried. It works
> very badly when the results of a 'select' are supposed to change something
> because you're supposed to be able to 'select' (and then not perform the
> operation) without affecting things. This is level semantics, not edge.
We're talking about a packet that was never readable. If you had an
efficient enough check ahead of time (perhaps implemented in
hardware?), it would never get to the point where select() was in this
position. The Linux developer of this section of code decided that they
wanted UDP to be more efficient by delaying the checksum validation until
the last minute. The cost of this, is that they broke the API with regard
to select(). This isn't being admitted. Instead, off-topic challenges of
POSIX, and impractical claims regarding the use of blocking file descriptors
with select() being not recommended have been offered.
These answers are simply wrong. If the decision is to make select() with
blocking file descriptors unreliable, than the decision *IS* to recommend
that select() never be used with blocking file descriptors. What kind of
operating system developers would recommend the use of select() if it is
known that the behaviour is unreliable?
> The CAVEAT is that 'select', like every other status information function
> provided by the kernel, does not guarantee anything about the future. Just
> like 'stat' does not guarantee that the file size will still be the same
> later when you call 'read'.
We're not talking about the future. Get off that horse.
We're talking about the present. At the time select() is invoked, there is
*no* available data. select() is lying.
Cheers,
mark
--
mark@mielke.cc/markm@ncf.ca/markm@nortelnetworks.com __________________________
. . _ ._ . . .__ . . ._. .__ . . . .__ | Neighbourhood Coder
|\/| |_| |_| |/ |_ |\/| | |_ | |/ |_ |
| | | | | \ | \ |__ . | | .|. |__ |__ | \ |__ | Ottawa, Ontario, Canada
One ring to rule them all, one ring to find them, one ring to bring them all
and in the darkness bind them...
http://mark.mielke.cc/
next prev parent reply other threads:[~2004-10-16 2:40 UTC|newest]
Thread overview: 191+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-10-06 14:52 UDP recvmsg blocks after select(), 2.6 bug? Joris van Rantwijk
2004-10-06 15:01 ` David S. Miller
2004-10-06 15:13 ` Chris Friesen
2004-10-06 15:15 ` Richard B. Johnson
2004-10-06 15:21 ` David S. Miller
2004-10-06 15:29 ` Richard B. Johnson
2004-10-06 15:42 ` David S. Miller
2004-10-06 15:57 ` Chris Friesen
2004-10-06 15:44 ` Lars Marowsky-Bree
2004-10-07 1:16 ` Paul Jakma
2004-10-07 7:10 ` Chris Friesen
2004-10-07 11:53 ` Paul Jakma
2004-10-07 13:32 ` Martijn Sipkema
2004-10-07 12:53 ` Paul Jakma
2004-10-07 13:12 ` Richard B. Johnson
2004-10-07 14:07 ` Martijn Sipkema
2004-10-07 13:19 ` Paul Jakma
2004-10-07 13:36 ` Paul Jakma
2004-10-07 15:01 ` Jean-Sebastien Trottier
2004-10-07 16:20 ` Chris Friesen
2004-10-07 18:20 ` Hua Zhong
2004-10-07 18:33 ` Chris Friesen
2004-10-07 22:41 ` Martijn Sipkema
2004-10-07 21:49 ` Chris Friesen
2004-10-07 22:00 ` David S. Miller
2004-10-07 22:24 ` Chris Friesen
2004-10-07 22:26 ` David S. Miller
2004-10-07 22:39 ` Chris Friesen
2004-10-07 22:42 ` David S. Miller
2004-10-07 23:27 ` Chris Friesen
2004-10-08 0:04 ` Ben Greear
2004-10-08 2:51 ` Mark Mielke
2004-10-08 3:39 ` David S. Miller
2004-10-08 3:48 ` Mark Mielke
2004-10-08 3:59 ` David S. Miller
2004-10-07 23:19 ` Martijn Sipkema
2004-10-07 22:24 ` David S. Miller
2004-10-07 22:33 ` Alan Curry
2004-10-07 22:42 ` Mark Mielke
2004-10-07 22:47 ` David S. Miller
2004-10-07 23:00 ` Mark Mielke
2004-10-07 23:07 ` David S. Miller
2004-10-08 6:10 ` Theodore Ts'o
2004-10-08 15:20 ` Mark Mielke
2004-10-08 0:37 ` Lee Revell
2004-10-07 22:46 ` Hua Zhong
2004-10-07 22:48 ` David S. Miller
2004-10-07 23:17 ` Martijn Sipkema
2004-10-07 13:45 ` Alan Cox
2004-10-07 16:32 ` Martijn Sipkema
2004-10-07 14:50 ` Alan Cox
2004-10-07 21:58 ` mmap specification - was: ... select specification Andries Brouwer
2004-10-07 22:17 ` Chris Wedgwood
2004-10-07 22:34 ` Andries Brouwer
2004-10-07 22:32 ` Kyle Moffett
2004-10-07 22:46 ` Andries Brouwer
2004-10-07 23:30 ` Kyle Moffett
2004-10-08 9:19 ` Andries Brouwer
2004-10-09 21:10 ` Martijn Sipkema
2004-10-07 13:48 ` UDP recvmsg blocks after select(), 2.6 bug? Alan Cox
2004-10-07 14:57 ` Richard B. Johnson
2004-10-07 15:18 ` Adam Heath
2004-10-07 16:39 ` Martijn Sipkema
2004-10-07 16:09 ` Mark Mielke
2004-10-07 17:18 ` Chris Friesen
2004-10-06 15:31 ` Chris Friesen
2004-10-06 15:41 ` David S. Miller
2004-10-06 16:07 ` Richard B. Johnson
2004-10-06 16:57 ` Neil Horman
2004-10-06 15:59 ` Paul Jackson
2004-10-06 16:35 ` Martijn Sipkema
2004-10-06 15:30 ` Chris Friesen
2004-10-06 15:09 ` Richard B. Johnson
2004-10-06 15:18 ` bert hubert
2004-10-06 16:41 ` Alan Cox
2004-10-06 18:04 ` Joris van Rantwijk
2004-10-06 19:30 ` Andries Brouwer
2004-10-06 19:23 ` Alan Cox
2004-10-06 22:08 ` Martijn Sipkema
2004-10-06 20:25 ` Alan Cox
2004-10-06 22:15 ` Andries Brouwer
2004-10-06 22:32 ` David S. Miller
2004-10-06 23:25 ` YOSHIFUJI Hideaki / 吉藤英明
2004-10-06 23:11 ` Willy Tarreau
2004-10-06 19:43 ` Hua Zhong
2004-10-06 19:54 ` Chris Friesen
2004-10-06 19:59 ` Hua Zhong
2004-10-06 20:10 ` Chris Friesen
2004-10-06 21:45 ` Martijn Sipkema
2004-10-06 23:35 ` David S. Miller
2004-10-06 20:06 ` David S. Miller
2004-10-06 20:18 ` Chris Friesen
2004-10-06 20:26 ` Hua Zhong
2004-10-06 20:38 ` Andries Brouwer
2004-10-06 20:58 ` Joris van Rantwijk
2004-10-06 22:29 ` David S. Miller
2004-10-07 16:08 ` Adrian Phillips
2004-10-06 20:06 ` Olivier Galibert
2004-10-06 23:35 ` David S. Miller
2004-10-07 0:19 ` Olivier Galibert
2004-10-07 0:29 ` David S. Miller
2004-10-07 10:56 ` Martijn Sipkema
2004-10-08 6:41 ` Willy Tarreau
2004-10-08 15:27 ` Mark Mielke
2004-10-15 22:42 ` Robert White
2004-10-15 23:33 ` David Schwartz
2004-10-16 0:59 ` Chris Friesen
2004-10-16 2:35 ` Mark Mielke [this message]
2004-10-16 4:23 ` David Schwartz
2004-10-16 4:35 ` Mark Mielke
2004-10-16 4:58 ` David Schwartz
2004-10-16 6:25 ` Mark Mielke
2004-10-16 21:44 ` Roland Kuhn
2004-10-17 0:06 ` Mark Mielke
2004-10-17 0:30 ` David Schwartz
2004-10-17 14:47 ` Mark Mielke
2004-10-17 0:28 ` David Schwartz
2004-10-17 13:35 ` Lars Marowsky-Bree
2004-10-17 14:17 ` Buddy Lucas
2004-10-17 15:05 ` Mark Mielke
2004-10-17 15:40 ` Buddy Lucas
2004-10-17 16:13 ` Lee Revell
2004-10-17 17:35 ` Jesper Juhl
2004-10-17 18:04 ` Buddy Lucas
2004-10-17 18:06 ` Lars Marowsky-Bree
2004-10-17 18:21 ` Buddy Lucas
2004-10-17 20:04 ` Martijn Sipkema
2004-10-17 20:08 ` Lars Marowsky-Bree
2004-10-17 17:35 ` Martijn Sipkema
2004-10-17 17:33 ` Buddy Lucas
2004-10-17 19:58 ` Martijn Sipkema
2004-10-17 19:33 ` Buddy Lucas
2004-10-17 20:11 ` Lars Marowsky-Bree
2004-10-17 20:25 ` Buddy Lucas
2004-10-17 20:42 ` Martijn Sipkema
2004-10-17 20:02 ` Buddy Lucas
2004-10-17 18:53 ` David Schwartz
2004-10-17 19:26 ` Hua Zhong
2004-10-17 20:32 ` Martijn Sipkema
2004-10-17 19:21 ` Hua Zhong
2004-10-17 17:22 ` Lars Marowsky-Bree
2004-10-17 17:54 ` Buddy Lucas
2004-10-17 18:05 ` Lars Marowsky-Bree
2004-10-17 18:06 ` Mark Mielke
2004-10-20 21:31 ` H. Peter Anvin
2004-10-20 21:58 ` Chris Friesen
2004-10-20 22:00 ` H. Peter Anvin
2004-10-20 22:12 ` Chris Friesen
2004-10-20 23:16 ` David Schwartz
2004-10-21 1:03 ` Chris Friesen
2004-10-21 1:38 ` David Schwartz
2004-10-21 3:01 ` Michael Clark
2004-10-21 3:52 ` Michael Clark
2004-10-21 4:10 ` H. Peter Anvin
2004-10-21 5:06 ` Chris Friesen
2004-10-21 5:11 ` H. Peter Anvin
2004-10-21 5:50 ` Chris Friesen
2004-10-21 5:58 ` H. Peter Anvin
2004-10-21 15:18 ` Chris Friesen
2004-10-21 6:14 ` Michael Clark
2004-10-17 14:52 ` Mark Mielke
2004-10-16 18:25 ` Andries Brouwer
2004-10-17 0:28 ` David Schwartz
2004-10-17 12:22 ` Andries Brouwer
2004-10-16 10:24 ` Willy Tarreau
2004-10-16 13:21 ` Mark Mielke
2004-10-18 22:25 ` Robert White
2004-10-06 20:41 ` Neil Horman
2004-10-06 22:27 ` Chris Friesen
2004-10-06 23:32 ` Neil Horman
2004-10-06 23:36 ` David S. Miller
2004-10-07 19:31 ` David Schwartz
2004-10-07 22:36 ` Martijn Sipkema
2004-10-08 0:19 ` David Schwartz
2004-10-09 19:21 ` Martijn Sipkema
2004-10-09 18:28 ` David Schwartz
2004-10-09 18:49 ` Mark Mielke
2004-10-09 21:00 ` Martijn Sipkema
2004-10-09 22:59 ` Mark Mielke
-- strict thread matches above, loose matches on Subject: below --
2004-10-06 15:30 Dan Kegel
2004-10-07 4:50 Dan Kegel
2004-10-07 8:04 ` bert hubert
2004-10-07 8:28 ` Adam Heath
2004-10-07 10:38 ` Martijn Sipkema
2004-10-07 10:07 ` Adam Heath
2004-10-07 11:29 ` Martijn Sipkema
2004-10-07 18:16 linux
2004-10-09 12:07 ` Colin Phipps
[not found] <fa.haprsoi.8k8kbk@ifi.uio.no>
[not found] ` <fa.isqjio8.ok2coo@ifi.uio.no>
2004-10-09 13:24 ` Bodo Eggert
2004-10-19 1:21 John Pearson
2004-10-19 13:50 ` Colin Phipps
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=20041016023537.GA17023@mark.mielke.cc \
--to=mark@mark.mielke.cc \
--cc=davids@webmaster.com \
--cc=linux-kernel@vger.kernel.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