[New-bugs-announce] [issue43727] futures cancelled by ThreadPoolExecutor.shutdown() not yielded by as_completed()
bbh
report at bugs.python.org
Sun Apr 4 07:59:46 EDT 2021
New submission from bbh <benj.luethi at gmx.net>:
concurrent.futures.ThreadPoolExecutor.shutdown(cancel_futures=True) cancels the pending futures, but the futures remain in the state CANCELLED and never get to the state CANCELLED_AND_NOTIFIED. Thus they are never yielded by concurrent.futures.as_completed().
If I use shutdown(cancel_futures=True) in a loop of as_completed(), the loop will never finish and the program hangs. Not even Ctrl-C works.
If I use concurrent.futures.Future.cancel() on all pending futures in the loop, everything works as expected.
----------
components: Library (Lib)
messages: 390183
nosy: bigbenhur
priority: normal
severity: normal
status: open
title: futures cancelled by ThreadPoolExecutor.shutdown() not yielded by as_completed()
type: behavior
versions: Python 3.9
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue43727>
_______________________________________
More information about the New-bugs-announce
mailing list