This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vstinner
Recipients christian.heimes, ezio.melotti, njs, pitrou, smurfix, vstinner
Date 2018-03-27.22:01:11
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1522188071.82.0.467229070634.issue32850@psf.upfronthosting.co.za>
In-reply-to
Content
> Lib/test/support/__init__.py::threading_cleanup() complains about dangling threads even if the reference in question would be cleaned up by the garbage collector.

It's a deliberate choice. It helped me to find real bugs. For example, I found a very old reference cycle in socket.create_connection().

The error message ("dangling threads") doesn't help, but it means that "something is wrong" in your test.

Sadly, sometimes you have to explicitly do something like "self.thread = None" in your test.

I wrote an article to explain these things:
https://vstinner.github.io/contrib-cpython-2017q3-part2.html

Instead of calling support.gc_collect(), I suggest to write documentation, maybe as a comment in support.threading_cleanup()?, explaining the warning and how to fix it. Maybe with a link to this issue? :-)
History
Date User Action Args
2018-03-27 22:01:11vstinnersetrecipients: + vstinner, pitrou, christian.heimes, ezio.melotti, smurfix, njs
2018-03-27 22:01:11vstinnersetmessageid: <1522188071.82.0.467229070634.issue32850@psf.upfronthosting.co.za>
2018-03-27 22:01:11vstinnerlinkissue32850 messages
2018-03-27 22:01:11vstinnercreate