Open
Description
Bug report
Bug description:
Potential follow up after the merge of #125663 (introduce buffersize
param in Executor.map
).
"Bug": concurrent.futures.Executor.map
temporarily exceeds its buffersize
while collecting the next result:
Let's define:
results: Iterator = executor.map(fn, iterable, buffersize=buffersize)
What happens when calling next(results)
:
- fetch the next
arg
frominterable
and put a task forfn(arg)
in the buffer - wait for next result to be available
- yield the collected result
So 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 a next
, we have to swap step 1. and step 2.
CPython versions tested on:
CPython main branch
Operating systems tested on:
No response
Linked PRs
Metadata
Metadata
Assignees
Labels
Python modules in the Lib dirPython modules in the Lib dirAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error