Skip to content

bpo-39995: Fix concurrent.futures._ThreadWakeup race condition #19758

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed

bpo-39995: Fix concurrent.futures._ThreadWakeup race condition #19758

wants to merge 1 commit into from

Conversation

vstinner
Copy link
Member

@vstinner vstinner commented Apr 28, 2020

Fix a race condition in concurrent.futures._ThreadWakeup: it now uses
an internal threading event to ensure pipe is not closed while
sending or receiving bytes.

Co-Authored-by: Kyle Stanley [email protected]

https://bugs.python.org/issue39995

@pitrou
Copy link
Member

pitrou commented Apr 28, 2020

I'm not sure why this is co-authored by me, as I wrote exactly zero line of code here.

@vstinner
Copy link
Member Author

Oops, that's Kyle Stanley's fix: https://bugs.python.org/issue39995#msg367486 it's not written by Antoine Pitrou :-)

This PR is basically a duplicate of closed PR #19751.

Fix a race condition in concurrent.futures._ThreadWakeup: it now uses
an internal threading event to ensure that the pipe is not closed
while sending or receiving bytes.

Co-Authored-by: Kyle Stanley <[email protected]>
@vstinner
Copy link
Member Author

This PR is basically a duplicate of closed PR #19751.

It seems like @pitrou doesn't like this approach. @tomMoral suggested to use a regular lock. I concur that the event looks unusal.

@tomMoral would prefer to avoid locking, so I wrote PR #19760 which is based on @tomMoral's idea.


@pitrou: "I'm not sure why this is co-authored by me, as I wrote exactly zero line of code here."

Sorry, I was confused between Kyle's proposal and your solution. I fixed the author.

@vstinner
Copy link
Member Author

PR #19760 sounds like a better approach, I abandon this PR.

@vstinner vstinner closed this Apr 28, 2020
@vstinner vstinner deleted the fix_futures_wakeup branch April 28, 2020 21:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants