Fix Calling waiters.wait_for_any() blocks if future has called Condition.wait()
condition.wait() can block forever even if Futures have completed
A similar issue was already fixed on cpython few years ago:
- https://bugs.python.org/issue20319
- https://hg.python.org/cpython/rev/0bcf23a52d55
- 2b754f49a5
Change-Id: I1fbad12a0d555e199fdf4073db9408a296e7fd8a
Related-Bug: #1848457
This commit is contained in:
parent
898326b814
commit
d3cb905629
|
@ -187,7 +187,8 @@ def _wait_for_all_green(fs, timeout=None):
|
|||
len(not_done))
|
||||
waiter.event.wait(timeout)
|
||||
for f in not_done:
|
||||
f._waiters.remove(waiter)
|
||||
with f._condition:
|
||||
f._waiters.remove(waiter)
|
||||
|
||||
with _acquire_and_release_futures(fs):
|
||||
done, not_done = _partition_futures(fs)
|
||||
|
@ -207,7 +208,8 @@ def _wait_for_any_green(fs, timeout=None):
|
|||
|
||||
waiter.event.wait(timeout)
|
||||
for f in fs:
|
||||
f._waiters.remove(waiter)
|
||||
with f._condition:
|
||||
f._waiters.remove(waiter)
|
||||
|
||||
with _acquire_and_release_futures(fs):
|
||||
done, not_done = _partition_futures(fs)
|
||||
|
|
Loading…
Reference in New Issue