If threading.Condition.notify() is interrupted just after it releases the waiter lock, but before remove it from the queue, the following calls of notify() will fail with RuntimeError: cannot release un-acquired lock. It can block the waiter threads if they do not use timeout.
|
for waiter in waiters_to_notify: |
|
waiter.release() |
|
try: |
|
all_waiters.remove(waiter) |
|
except ValueError: |
|
pass |
The simplest solution would be to silence a RuntimeError in waiter.release(). There may be similar issues in other parts of the code.
If
threading.Condition.notify()is interrupted just after it releases the waiter lock, but before remove it from the queue, the following calls ofnotify()will fail withRuntimeError: cannot release un-acquired lock. It can block the waiter threads if they do not use timeout.cpython/Lib/threading.py
Lines 375 to 380 in 5bc2390
The simplest solution would be to silence a RuntimeError in
waiter.release(). There may be similar issues in other parts of the code.