Skip to content

gh-159689: Fix ProcessPoolExecutor hang when a worker is killed mid-result - #159697

Open
junaidkhan80121 wants to merge 9 commits into
python:mainfrom
junaidkhan80121:gh-159689-processpool-mid-send
Open

junaidkhan80121 wants to merge 9 commits into
python:mainfrom
junaidkhan80121:gh-159689-processpool-mid-send

Conversation

@junaidkhan80121

@junaidkhan80121 junaidkhan80121 commented Oct 19, 2026 •

Copy link
Copy Markdown

Summary

Fixes #159689.

A ProcessPoolExecutor worker killed while writing a large result left the future pending and blocked interpreter shutdown. Connection.recv() now watches worker sentinels for the rest of the message and raises BrokenProcessPool. Callers that do not pass sentinels keep the previous behavior.

Test plan

  • ./python -m test -j4 on Linux, built from this tree: 50,080 tests, SUCCESS
  • test_concurrent_futures.test_process_pool covers a header-only message, a complete message, and SIGKILL after the result header
  • macOS and Windows CI

… mid-result

A worker killed after writing part of a large result left the manager
thread blocked in Connection.recv(). The parent holds the result pipe's
write end, so that death is not delivered as EOF. Watch worker sentinels
for the rest of the message and raise BrokenProcessPool.
@python-cla-bot

python-cla-bot Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

All commit authors signed the Contributor License Agreement.

CLA signed

@junaidkhan80121

Copy link
Copy Markdown
Author

The remaining Windows (free-threading) x64 tail-call failure is in test_urllib2net (test_ftp_no_leak and test_ftp_timeout): ftp://www.pythontest.net returned "425 Security: Bad IP connecting." test_process_pool passed. This looks like the known runner flake from #79592. Could a triager re-run the failed job?

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.

ProcessPoolExecutor: future never completes and interpreter cannot exit when a worker is killed while sending its result

1 participant