[issue19293] test_asyncio hanging for 1 hour

Charles-François Natali report at bugs.python.org
Sat Oct 19 20:24:17 CEST 2013


Charles-François Natali added the comment:

> Guido van Rossum added the comment:
>
> Actually, I think we're talking about the actual select() syscal not
> returning when SIGCHLD is received and handled. Running the C-level handler
> isn't enough, the syscall must return with EINTR so the Python handler can
> run (which then writes a byte to the self-pipe to ensure select() returns,
> but that seems too late). Maybe twiddling with SA_RESTART can fix this?

Hum, I just check asyncio's code, and it's not doing what I thought it
was doing.

SA_RESTART won't help: PyOS_setsig() already doesn't set it, and also
calls siginterrupt() to ensure the syscall will be interrupted, but as
can been seen here, that's not portable.

The correct way to do this, IMO, would be to simply change
BaseSelectorEventLoop._read_from_self() to read the signal number from
the wakeup FD (Python's signal handler writes the signal number to
this FD): then, we could call directly call the relevant signal
handler. This way, this would succeed even if select()/poll()/whatever
doesn't fail with EINTR (it'll also be a bit simpler/faster).
I thought that's how it was done in tulip!

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue19293>
_______________________________________


More information about the Python-bugs-list mailing list