[issue2496] test_no_refcycle_through_target sometimes fails in test_threading

Antoine Pitrou report at bugs.python.org
Thu Mar 27 17:22:40 CET 2008


Antoine Pitrou <pitrou at free.fr> added the comment:

Hmm, I think I know what happens. t_bootstrap() in threadmodule.c calls
the self.__bootstrap() method in the Thread object, and it is this
method which sets the __stopped flag at its end, which in turns wakes up
the join() method.

The problem is that at this point, t_bootstrap() still (rightly) holds a
reference to the Thread object, since it has a reference to its
__bootstrap() method which is still running. Depending on how the
operating system switches threads, this reference may or may not be
released when the join() method returns.

So I think it's the test that is flaky. Instead of calling the join()
method, it should wait for the OS-level thread to finish. Or it should
find another way of testing for the reference cycle.

__________________________________
Tracker <report at bugs.python.org>
<http://bugs.python.org/issue2496>
__________________________________


More information about the Python-bugs-list mailing list