[issue21645] test_read_all_from_pipe_reader() of test_asyncio hangs on FreeBSD 9

STINNER Victor report at bugs.python.org
Tue Jul 15 22:54:03 CEST 2014


STINNER Victor added the comment:

(1) the thread B gets the SIGCHLD signal: it writes a byte into the "self" pipe of the event loop

   C signal_handler: sig_num=20, thread=34468857856
   trip_signal(20): write()

(2) in the main thread, the event loop is awaken by the write in the pipe... but there is nothing to do

   _read_from_self -> b'\x14', thread=34384933888

(3) the thread B schedules the callback

   Py_AddPendingCall(checksignals_witharg), thread=34468857856

(I modified the output a little bit for readability.)

IMO the problem is that asyncio relies on two events:

* signal number written in the "self" pipe of the event loop
* callback scheduled by the C handler

A solution would be to schedule the callback in the event loop. Since Python 3.3, the C signal handler writes the signal number, which should be enough to find and schedule the Python callback.

----------

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


More information about the Python-bugs-list mailing list