[issue46726] Thread spuriously marked dead after interrupting a join call

Ben report at bugs.python.org
Fri Feb 11 19:33:05 EST 2022


Ben <benjsimner at gmail.com> added the comment:

You are right,

What one really needs here is a way to know *who* owns the lock,
but threading.Lock does not provide that.

The race on := is much smaller than the original race and I suspect in practice will be very hard to hit.

As the original bpo notes, it may not be possible to write a complete fix for this in pure Python, after all there may always be another interrupt between the `except` and the second attempted `release`.

The issue with the solution was that it turned a relatively hard-to-hit race condition into a really easy-to-hit one,  but perhaps the outcome is slightly less worse?

----------

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


More information about the Python-bugs-list mailing list