-
-
Notifications
You must be signed in to change notification settings - Fork 33.1k
gh-87135: Hang non-main threads that attempt to acquire the GIL during finalization #105805
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
Merged
Merged
Changes from 1 commit
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
30c8135
gh-87135: Hang non-main threads that attempt to acquire the GIL durin…
jbms 3c3d552
Merge branch 'main' into new-gil-hang
gpshead da37473
docs fixups
gpshead 3ec84f6
doc fixup, use the new next versionchanged docs feature.
gpshead 2bc54ca
deprecated in 3.14
gpshead 80d2c49
use the gh- ref instead of bpo- everywhere.
gpshead 9b1eaf6
Remove wrong comments, improve others.
gpshead cf76777
expand the comment.
gpshead 2dae315
more docs
gpshead 28118a0
update a comment
gpshead 87249ab
address review comments.
gpshead afe5507
include what you use for pause()
gpshead e05a127
improve comments.
gpshead ec0e07a
Merge branch 'main' into new-gil-hang
gpshead 1569700
wasi doesn't have pause()?!? try sleep(9999999)
gpshead ac3b2ce
more wasi workarounds.
gpshead ac3d2be
Skip the new test under TSAN (and MSAN).
gpshead File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
Misc/NEWS.d/next/C API/2022-08-05-19-41-20.gh-issue-87135.SCNBYj.rst
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
Attempting to acquire the GIL after runtime finalization has begun in a | ||
different thread now causes the thread to hang rather than terminate, which | ||
avoids potential crashes or memory corruption caused by attempting to | ||
terminate a thread that is running code not specifically designed to support | ||
termination. In most cases this hanging is harmless since the process will | ||
soon exit anyway. | ||
|
||
The ``PyThread_exit_thread`` function is now deprecated. Its behavior is | ||
inconsistent across platforms, and it can only be used safely in the | ||
unlikely case that every function in the entire call stack has been designed | ||
to support the platform-dependent termination mechanism. It is recommended | ||
that users of this function change their design to not require thread | ||
termination. In the unlikely case that thread termination is needed and can | ||
be done safely, users may migrate to calling platform-specific APIs such as | ||
``pthread_exit`` (POSIX) or ``_endthreadex`` (Windows) directly. |
3 changes: 3 additions & 0 deletions
3
Misc/NEWS.d/next/Core and Builtins/2021-09-22-14-19-02.bpo-42969.8Z2mth.rst
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
Daemon threads and other threads not created by Python are now paused rather | ||
than unsafely terminated if they attempt to acquire the GIL during Python | ||
finalization. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
Uh oh!
There was an error while loading. Please reload this page.