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 neologix
Recipients David.Edelsohn, gvanrossum, neologix, python-dev, skrah
Date 2013-10-19.18:24:17
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <CAH_1eM1Pn-j6EMjsR9se+3E8AxVOPffE=1vntsoOcTmwuhnY3w@mail.gmail.com>
In-reply-to <CAP7+vJLatN-SG4LjEsLDdqA5ievvxYvV9q-uVPY=+qy6NLRR1g@mail.gmail.com>
Content
> 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!
History
Date User Action Args
2013-10-19 18:24:17neologixsetrecipients: + neologix, gvanrossum, skrah, python-dev, David.Edelsohn
2013-10-19 18:24:17neologixlinkissue19293 messages
2013-10-19 18:24:17neologixcreate