]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
[3.10] bpo-37788: Fix reference leak when Thread is never joined (GH-26103) (GH-26138)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Sat, 15 May 2021 09:24:44 +0000 (02:24 -0700)
committerGitHub <noreply@github.com>
Sat, 15 May 2021 09:24:44 +0000 (02:24 -0700)
commit71dca6ea73aaf215fafa094512e8c748248c16b0
tree848a16f29f4098ea9e81e2ff6e88540920563e72
parent2e99869f64bbd3c6590cb5ceaf9cf59e63689d63
[3.10] bpo-37788: Fix reference leak when Thread is never joined (GH-26103) (GH-26138)

When a Thread is not joined after it has stopped, its lock may remain in the _shutdown_locks set until interpreter shutdown.  If many threads are created this way, the _shutdown_locks set could therefore grow endlessly.  To avoid such a situation, purge expired locks each time a new one is added or removed.
(cherry picked from commit c10c2ec7a0e06975e8010c56c9c3270f8ea322ec)

Co-authored-by: Antoine Pitrou <antoine@python.org>
Lib/test/test_threading.py
Lib/threading.py
Misc/NEWS.d/next/Library/2021-05-13-19-07-28.bpo-37788.adeFcf.rst [new file with mode: 0644]