This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vstinner
Recipients giampaolo.rodola, gvanrossum, pitrou, python-dev, vstinner, yselivanov
Date 2014-07-15.20:54:03
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
(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.
Date User Action Args
2014-07-15 20:54:03vstinnersetrecipients: + vstinner, gvanrossum, pitrou, giampaolo.rodola, python-dev, yselivanov
2014-07-15 20:54:03vstinnersetmessageid: <>
2014-07-15 20:54:03vstinnerlinkissue21645 messages
2014-07-15 20:54:03vstinnercreate