[Python-Dev] asyncore fixes in Python 2.6 broke Zope's version of medusa
glyph at divmod.com
glyph at divmod.com
Fri Mar 6 11:56:42 CET 2009
On 10:01 am, greg.ewing at canterbury.ac.nz wrote:
>Hrvoje Niksic wrote:
>> Under Linux, select() may report a socket file descriptor
>> as "ready for reading", while nevertheless
>> a subsequent read blocks.
>
>Blarg. Linux is broken, then. This should not happen.
You know what else is broken? MacOS, FreeBSD, Solaris, and every
version of Windows. I haven't tried running Twisted on AmigaOS but I
bet it has some problems too.
On occasion Linux has been so badly broken that Twisted has motivated a
fix. For example,
http://lkml.indiana.edu/hypermail/linux/kernel/0502.3/1160.html
But even if we ignore difficulties at the OS level (which should, after
all, be worked around rather than catered to in API design) there are
other good reasons why the general async API should be fairly distant
from both the select/poll wrapper and the questions of blocking vs. non-
blocking sockets. For another example, consider the issue of non-
blocking SSL sockets. Sometimes, in order to do a "read", you actually
need to do a write and then another read. Which means that application
code, if it wants to be compatible with SSL, needs to deal with any
failure that may come from a write as coming from a read, unless you
abstract all this away somehow.
More information about the Python-Dev
mailing list