Skip to content

gh-155477: Fix multiprocessing.Pool deadlock on close() with a buffersize imap - #155478

Open
tonghuaroot wants to merge 1 commit into
python:mainfrom
tonghuaroot:fix-pool-buffersize-close
Open

gh-155477: Fix multiprocessing.Pool deadlock on close() with a buffersize imap#155478
tonghuaroot wants to merge 1 commit into
python:mainfrom
tonghuaroot:fix-pool-buffersize-close

Conversation

@tonghuaroot

@tonghuaroot tonghuaroot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

The buffersize variant of Pool.imap()/imap_unordered() throttles the task
generator on a semaphore. close() did not release those semaphores (only
terminate() did), so a partially-consumed iterator left the task handler
blocked in sema.acquire() and join() deadlocked. Release the buffersize
semaphores in close(), and stop the task generator once the pool leaves the
RUN state. Introduced in gh-64192.

…buffersize imap

close() did not release the buffersize semaphores that throttle the task
generator, so a partially-consumed imap left the task handler blocked and
join() deadlocked. Release them in close() and stop the generator once the
pool leaves the RUN state.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant