Re: UDP recvmsg blocks after select(), 2.6 bug?

Chris Friesen
2004-10-16T01:00:06Z

David Schwartz wrote:

> 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'.

This is not a very good counterexample. If I'm the only one accessing a file,
then the file size should not just change all by itself.

As you say, select is level triggered. However, the very definition of select
returning a file descriptor as readable is that a subsequent read will not
block. This seems very straightforward. Maybe it's not the best from a
performance point of view, but it's very straightforward.

So if we change the semantics slightly to say that select returning readable
really means a subsequent *blocking* read will not block, then apps that use
blocking sockets will get proper semantics, and apps using nonblocking reads
will get full performance.

As it stands, it's fairly straightforward to do a DOS and hang various apps with
a single corrupt packet each. This is suboptimal.

Chris