summaryrefslogtreecommitdiff
path: root/Misc
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2019-06-13 05:22:20 -0700
committerVictor Stinner <vstinner@redhat.com>2019-06-13 14:22:20 +0200
commit6eb2878e42152e9c45d7ee5e6f889532d753e67c (patch)
tree5af19e9d78170a19b388f9e7c2c329f3820f4006 /Misc
parentb4c8ef7c67712c6639ee896bf7cb8ca1c204946d (diff)
downloadcpython-git-6eb2878e42152e9c45d7ee5e6f889532d753e67c.tar.gz
bpo-36402: Fix threading._shutdown() race condition (GH-13948) (GH-14050) (GH-14054)
* bpo-36402: Fix threading._shutdown() race condition (GH-13948) Fix a race condition at Python shutdown when waiting for threads. Wait until the Python thread state of all non-daemon threads get deleted (join all non-daemon threads), rather than just wait until Python threads complete. * Add threading._shutdown_locks: set of Thread._tstate_lock locks of non-daemon threads used by _shutdown() to wait until all Python thread states get deleted. See Thread._set_tstate_lock(). * Add also threading._shutdown_locks_lock to protect access to threading._shutdown_locks. * Add test_finalization_shutdown() test. (cherry picked from commit 468e5fec8a2f534f1685d59da3ca4fad425c38dd) * bpo-36402: Fix threading.Thread._stop() (GH-14047) Remove the _tstate_lock from _shutdown_locks, don't remove None. (cherry picked from commit 6f75c873752a16a7ad8f35855b1e29f59d048e84) (cherry picked from commit e40a97a721d46307dfdc2b0322028ccded6eb571) Co-authored-by: Victor Stinner <vstinner@redhat.com>
Diffstat (limited to 'Misc')
-rw-r--r--Misc/NEWS.d/next/Library/2019-06-11-00-35-02.bpo-36402.b0IJVp.rst4
1 files changed, 4 insertions, 0 deletions
diff --git a/Misc/NEWS.d/next/Library/2019-06-11-00-35-02.bpo-36402.b0IJVp.rst b/Misc/NEWS.d/next/Library/2019-06-11-00-35-02.bpo-36402.b0IJVp.rst
new file mode 100644
index 0000000000..3bc537e40f
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2019-06-11-00-35-02.bpo-36402.b0IJVp.rst
@@ -0,0 +1,4 @@
+Fix a race condition at Python shutdown when waiting for threads. Wait until
+the Python thread state of all non-daemon threads get deleted (join all
+non-daemon threads), rather than just wait until non-daemon Python threads
+complete.