forked from python/cpython
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
pythongh-87135: Hang non-main threads that attempt to acquire the GIL…
… during finalization
- Loading branch information
Showing
9 changed files
with
215 additions
and
22 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 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 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 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 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 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