non-blocking IO EAGAIN on write

Thomas Guettler hv at tbz-pariv.de
Mon Jul 26 04:56:48 EDT 2010


John Nagle wrote:
> On 7/23/2010 1:45 AM, Thomas Guettler wrote:
>> Hi,
>>
>> I use non-blocking io to check for timeouts. Sometimes I get EAGAIN
>> (Resource temporarily unavailable)
>> on write(). My working code looks like this. But I am unsure how many
>> bytes have been written to the
>> pipe if I get an EAGAIN IOError.

....


>     Since your code isn't doing anything else while waiting for a
> write to complete on the pipe, why use non-blocking I/O at all?
> 
> (I know, the Python I/O timeout logic is broken in some versions.
> You're probably working around that.)

I want to handle timeouts. The app runs on linux, but I don't want to use
signals, since it is in a wsgi context:

http://code.google.com/p/modwsgi/wiki/ApplicationIssues
> .. As a general rule therefore, no WSGI application component should
> attempt to register its own signal handlers.
>

The hint of Kushal was right: The timeout was reached, and I didn't check
the result of the select call.

-- 
Thomas Guettler, http://www.thomas-guettler.de/
E-Mail: guettli (*) thomas-guettler + de



More information about the Python-list mailing list