Skip to content
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

Fix deadlock on shutdown if test_current_{exception,frames} fails #102019

Merged
merged 3 commits into from
Feb 23, 2023

Conversation

jbower-fb
Copy link
Contributor

@jbower-fb jbower-fb commented Feb 18, 2023

These tests spawn a thread that waits on a threading.Event. If the test fails any of its assertions, the Event won't be signaled and the thread will wait indefinitely, causing a deadlock when threading._shutdown() tries to join all outstanding threads.

The solution is just to put the code in a try-finally block, with the existing clean-up in the finally.

@swtaarrs found and fixed this originally while working on Cinder.

Hopefully this is trivial enough to not need an issue or a NEWS blurb.

@bedevere-bot bedevere-bot added awaiting review tests Tests in the Lib/test dir labels Feb 18, 2023
@bedevere-bot
Copy link

Most changes to Python require a NEWS entry.

Please add it using the blurb_it web app or the blurb command-line tool.

jbower-fb and others added 2 commits February 23, 2023 13:25
These tests spawn a thread that waits on a threading.Event. If the test fails any of its assertions, the Event won't be signaled and the thread will wait indefinitely, causing a deadlock when threading._shutdown() tries to join all outstanding threads.

Co-authored-by: Brett Simmers <bsimmers@meta.com>
@DinoV DinoV merged commit 0c85786 into python:main Feb 23, 2023
@jbower-fb jbower-fb deleted the fix-deadlock branch February 23, 2023 23:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
skip issue tests Tests in the Lib/test dir
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants