Spurious readiness notification for Select System call
Asked Answered
I

1

10

On http://linux.die.net/man/2/select, under BUGS section it is mentioned that the select system call may sometimes spuriously set the FD ready and the subsequent read call will return 0. The text describes one such example (wrong checksum) but I am assuming there would be other reasons too (otherwise they would have fixed this).

Any ideas what could the other causes for Select to return a FD ready spuriously.

and does this apply to other OS'es also. I am currently asking about Linux.

Relevant Section for the link above:

Under Linux, select() may report a socket file descriptor as "ready for reading", while nevertheless a subsequent read blocks. This could for example happen when data has arrived but upon examination has wrong checksum and is discarded. There may be other circumstances in which a file descriptor is spuriously reported as ready. Thus it may be safer to use O_NONBLOCK on sockets that should not block.

Imprison answered 13/5, 2009 at 14:27 Comment(0)
R
1

This is not exactly an answer, but looking over epoll, these problems seem to be solved for it.

And if I can trust this message in netdev, they at least tried to fix it in poll() and select() too (breaking other things).

Thus, this bug doesn't seem to be relevant in foreseeable future.

Rosemonde answered 1/4, 2011 at 8:25 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.