summaryrefslogtreecommitdiffstats
path: root/Misc
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@redhat.com>2019-06-12 23:30:17 (GMT)
committerGitHub <noreply@github.com>2019-06-12 23:30:17 (GMT)
commit468e5fec8a2f534f1685d59da3ca4fad425c38dd (patch)
treeab031e145d86984c0a6236053e8768207e3b2fb2 /Misc
parentb4c7defe58695a6670a8fdeaef67a638bbb47e42 (diff)
downloadcpython-468e5fec8a2f534f1685d59da3ca4fad425c38dd.zip
cpython-468e5fec8a2f534f1685d59da3ca4fad425c38dd.tar.gz
cpython-468e5fec8a2f534f1685d59da3ca4fad425c38dd.tar.bz2
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.
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 0000000..3bc537e
--- /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.