`concurrent.futures.Executor.map` temporarily exceeds its `buffersize` while collecting the next result
Nessuno ha ancora preso questa issue.
- Lingua principale
- Python
- Stelle
- 77.2k
- Fork
- 35.9k
- Metriche di merge delle PR
- Metriche PR in attesa
Descrizione
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
argfrominterableand 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
- gh-131467
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Inizia da concurrent.futures.Executor.map e rivedi il comportamento descritto in merito alla raccolta del risultato successivo. Controlla la PR collegata gh-131467 per comprendere il lavoro già in corso. Il lavoro è completato quando si garantisce che il buffer non superi mai temporaneamente il buffersize richiesto mentre next(results) attende un risultato.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- python
- Ambito
- backend
- Tipo di issue
- Bug
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 25/100