[New-bugs-announce] [issue37788] fix for bpo-36402 (threading._shutdown() race condition) causes reference leak

Anselm Kruis report at bugs.python.org
Wed Aug 7 12:22:52 EDT 2019


New submission from Anselm Kruis <a.kruis at science-computing.de>:

Starting with commit 468e5fec (bpo-36402: Fix threading._shutdown() race condition (GH-13948)) the following trivial test case leaks one reference and one memory block.

class MiscTestCase(unittest.TestCase):
    def test_without_join(self):
        # Test that a thread without join does not leak references.
        # Use a debug build and run "python -m test -R: test_threading"
        threading.Thread().start()

Attached is a patch, that adds this test case to Lib/test/test_threading.py. After you apply this patch "python -m test -R: test_threading" leaks one (additional) reference. This leak is also present in Python 3.7.4 and 3.8.

I'm not sure, if it correct not to join a thread, but it did work flawlessly and didn't leak in previous releases.
I didn't analyse the root cause yet.

----------
components: Library (Lib)
files: threading-leak-test-case.diff
keywords: patch
messages: 349173
nosy: anselm.kruis
priority: normal
severity: normal
status: open
title: fix for bpo-36402 (threading._shutdown() race condition) causes reference leak
type: resource usage
versions: Python 3.7, Python 3.8, Python 3.9
Added file: https://bugs.python.org/file48534/threading-leak-test-case.diff

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue37788>
_______________________________________


More information about the New-bugs-announce mailing list