New submission from Glenn Langford:
concurrent.futures.wait() can get into a state where it blocks forever on
waiter.event.wait(), even when the underlying Futures have completed.
This is demonstrated in a stress test where a large number of wait() calls are
run in multiple threads, contending for the same Futures.
The cause is believed to be waiter removal, which is done without locking the
Future.
A suggested fix which appears to work is to change the following code in wait():
for f in fs:
f._waiters.remove(waiter)
to:
for f in fs:
with f._condition:
f._waiters.remove(waiter)
----------
components: Library (Lib)
files: stress_wait.py
messages: 208592
nosy: glangford
priority: normal
severity: normal
status: open
title: concurrent.futures.wait() can block forever even if Futures have
completed
type: behavior
versions: Python 3.3, Python 3.4
Added file: http://bugs.python.org/file33580/stress_wait.py
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue20319>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com