GeezerVison is showing github.com — gh-161668: Refuse multiprocessing messages too large for a Windows pipe by dennev · Pull Request #161685 · python/cpython
Conversation
dennev
commented
Nov 9, 2026
•
edited by bedevere-app
Bot
Loading
Uh oh!
There was an error while loading. Please reload this page.
Windows refuses a single pipe write of more than 0xFFFFFFCF bytes, but may already have completed a read that the other end was waiting on, with ERROR_MORE_DATA and nothing left in the pipe; that reader then fails at assert left > 0 in PipeConnection._get_more_data(). As discussed in #161668, this checks the size in PipeConnection._send_bytes() before anything is written and raises ValueError, the exception the documentation of send() and send_bytes() names. Supporting larger messages needs a header that stays compatible between Python versions and is left for later. The check uses the measured limit; a round margin such as 0xFFFF0000 would be a one-line change.
test_send_bytes_too_large lowers the limit and runs without -M; test_send_bytes_too_large_for_windows is a bigmemtest (-M 4G; it holds one 4 GiB buffer at a time) with the real sizes. Both give a receiver thread 0.1 s to block in recv_bytes() before the oversized send, then check that it gets the next message; the first also sends a message of exactly the limit. Without the change the first fails with "ValueError not raised" and the second with OSError: [WinError 87]. I also checked on a debug build that a message of exactly 0xFFFFFFCF bytes still arrives whole, and that a Pool worker survives a task that is too large and runs the next one.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
…ows pipe
Windows refuses a single pipe write of more than 0xFFFFFFCF bytes with
ERROR_INVALID_PARAMETER, but may already have completed a read that the
other end was waiting on, with ERROR_MORE_DATA and nothing left in the
pipe. The reader then fails at "assert left > 0" in
PipeConnection._get_more_data(), which kills a Pool worker. Check the
size in PipeConnection._send_bytes() and raise ValueError, as the
documentation of send() and send_bytes() describes, before anything is
written, so both ends stay usable.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
All commit authors signed the Contributor License Agreement.

|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Reviewers
gpshead
Awaiting requested review from gpshead
gpshead is a code owner
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
|