[issue7264] test_threading_local sometimes hangs when run with -R

Antoine Pitrou report at bugs.python.org
Wed Nov 4 21:23:12 CET 2009


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

It turns out that the __del__ method in _threading_local.py tries to
call threading.enumerate() which itself takes the _active_limbo_lock.
The problem is that __del__ can be called at any point in time (because
of the GC), including at a point where the same thread has already taken
the lock. The obvious fix is to bypass enumerate().

(an alternate fix would be to use an RLock for _active_limbo_lock, but
it could have unforeseen consequences, such as performance ones)

----------
keywords: +patch
Added file: http://bugs.python.org/file15259/threading_local.patch

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue7264>
_______________________________________


More information about the Python-bugs-list mailing list