Fix bpo-30589: improve Process.exitcode with forkserver#1989
Conversation
When the child is killed, Process.exitcode should return -signum, not 255.
|
@pitrou, thanks for your PR! By analyzing the history of the files in this pull request, we identified @shibturn, @benjaminp and @jnoller to be potential reviewers. |
|
@cf-natali, do you know if the SIGCHLD strategy used here is reliable? |
|
Yes, the patch looks good (now that we correctly handle EINTR, which will
happen now that SIGCHLD has a handler).
Slight nit: in theory, the read-end of the self-pipe (sig_r) should also be
set non-blocking, because it's in theory possible to get spurious
notification in select, in which case the read would hang: but I'm not
aware of any reason this could happen on a pipe.
2017-06-08 18:52 GMT+01:00 Antoine Pitrou <notifications@github.com>:
… @cf-natali <https://github.com/cf-natali>, do you know if the SIGCHLD
strategy used here is reliable?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#1989 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AH_Xc918qMReuWaaTO3JMtDXVfd-bYMvks5sCDTvgaJpZM4Nzcbx>
.
|
bb62a7f to
e30cdc4
Compare
|
Thanks for the review @cf-natali. There are other places in forkserver where spurious notifications are not considered, so I'm gonna judge that the |
|
I've determined that this PR suffers from a race condition (a well-known one, admittedly): SIGCHLD can arrive just before The solution seems to be to use |
…hon#1989) There's an admittedly well-known race condition where ECHILD can arrive just before the C function epoll_wait() and the latter wouldn't therefore return EINTR. The solution is to use set_wakeup_fd(), which was designed to avoid such race conditions.
…p to PR #1989) (#2139) * Fix race condition in signal wakeup in forkserver (followup to PR #1989) There's an admittedly well-known race condition where ECHILD can arrive just before the C function epoll_wait() and the latter wouldn't therefore return EINTR. The solution is to use set_wakeup_fd(), which was designed to avoid such race conditions. * Reset wakeup fd in child
When the child is killed, Process.exitcode should return -signum, not 255.