concurrent.futures.Executor.map
temporarily exceeds its buffersize
while collecting the next result
#131466
Labels
stdlib
Python modules in the Lib dir
topic-multiprocessing
type-bug
An unexpected behavior, bug, or error
Bug report
Bug description:
Potential follow up after the merge of #125663 (introduce
buffersize
param inExecutor.map
)."Bug":
concurrent.futures.Executor.map
temporarily exceeds itsbuffersize
while collecting the next result:Let's define:
What happens when calling
next(results)
:arg
frominterable
and put a task forfn(arg)
in the bufferSo during step 2. the buffer's size is actually
buffersize + 1
.If we want a strict guarantee that there is at most
buffersize
concurrent tasks even during anext
, we have to swap step 1. and step 2.CPython versions tested on:
CPython main branch
Operating systems tested on:
No response
Linked PRs
concurrent.futures.Executor.map
: avoid temporarily exceedingbuffersize
while collecting the next result #131467The text was updated successfully, but these errors were encountered: