GeezerVison is showing github.com — gh-104341: Wait Completely at threading._shutdown() by ericsnowcurrently · Pull Request #104672 · python/cpython
Conversation
(This should solve the semi-frequent buildbot failures we've been seeing.)
In Py_EndInterpreter() we almost immediately wait for all non-daemon Python threads to finish, by calling theading._shutdown(). However, with a per-interpreter GIL there's a race because threading._shutdown() doesn't wait long enough. This change fixes that by making sure _PyThreadState_DeleteCurrent() completely finishes before releasing the lock on which threading._shutdown() depends.
The gist of it is that we release that lock (and clean it up) later than we would normally be able to, by doing the cleanup in another thread via a "pending" call.
This isn't an ideal solution, but other approaches I tried involved more invasive changes, which I'd like to avoid this close to the beta 1 release.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
I plan on revisiting this problem, to introduce a better long-term solution. However, that probably won't be in 3.12.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
Ae you still going with this, or has it been superseded?
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
It's superseded for the moment. I'm likely to revisit this for 3.13.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
|