Skip to content

bpo-30643: Fix race condition in signal wakeup in forkserver (followup to PR #1989)#2139

Merged
pitrou merged 2 commits into
python:masterfrom
pitrou:forkserver_epoll_signal_race
Jun 13, 2017
Merged

bpo-30643: Fix race condition in signal wakeup in forkserver (followup to PR #1989)#2139
pitrou merged 2 commits into
python:masterfrom
pitrou:forkserver_epoll_signal_race

Conversation

@pitrou

@pitrou pitrou commented Jun 12, 2017

Copy link
Copy Markdown
Member

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.

…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.
@vstinner vstinner changed the title Fix race condition in signal wakeup in forkserver (followup to PR #1989) bpo-30643: Fix race condition in signal wakeup in forkserver (followup to PR #1989) Jun 13, 2017
@pitrou pitrou merged commit 2b5cc5e into python:master Jun 13, 2017
@pitrou pitrou deleted the forkserver_epoll_signal_race branch June 13, 2017 07:46
try:
os.write(sig_w, b'.')
except BlockingIOError:
pass

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like this change :-) Using the existing C signal handler for the write is probably more reliable ;-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants