gh-118981: multiprocessing.popen_spawn_posix, fix potential hang#118982
Merged
gpshead merged 3 commits intopython:mainfrom Sep 7, 2025
Merged
gh-118981: multiprocessing.popen_spawn_posix, fix potential hang#118982gpshead merged 3 commits intopython:mainfrom
gpshead merged 3 commits intopython:mainfrom
Conversation
Contributor
Author
|
@gpshead ping? Or anyone else? |
gpshead
approved these changes
Sep 6, 2025
|
🤖 New build scheduled with the buildbot fleet by @gpshead for commit 4c9fd26 🤖 Results will be shown at: https://buildbot.python.org/all/#/grid?branch=refs%2Fpull%2F118982%2Fmerge If you want to schedule another build, you need to add the 🔨 test-with-buildbots label again. |
miss-islington
pushed a commit
to miss-islington/cpython
that referenced
this pull request
Sep 7, 2025
pythongh-118982) fix potential hang. It can happen that the child crashes right in the beginning for whatever reason. In this case, the parent will hang when writing into the pipe, because the child fd is not closed yet. The normal pattern is to close the child fds right after the child proc is forked/executed/spawned, so when the child dies, then also the pipes will be closed, and there will be no hang (the parent gets SIGPIPE instead). (cherry picked from commit 8ed5a2b) Co-authored-by: Albert Zeyer <albzey@gmail.com>
miss-islington
pushed a commit
to miss-islington/cpython
that referenced
this pull request
Sep 7, 2025
pythongh-118982) fix potential hang. It can happen that the child crashes right in the beginning for whatever reason. In this case, the parent will hang when writing into the pipe, because the child fd is not closed yet. The normal pattern is to close the child fds right after the child proc is forked/executed/spawned, so when the child dies, then also the pipes will be closed, and there will be no hang (the parent gets SIGPIPE instead). (cherry picked from commit 8ed5a2b) Co-authored-by: Albert Zeyer <albzey@gmail.com>
|
GH-138605 is a backport of this pull request to the 3.14 branch. |
|
GH-138606 is a backport of this pull request to the 3.13 branch. |
gpshead
pushed a commit
that referenced
this pull request
Sep 7, 2025
…ng (gh-118982) (#138606) gh-118981: multiprocessing.popen_spawn_posix, fix potential hang (gh-118982) fix potential hang. It can happen that the child crashes right in the beginning for whatever reason. In this case, the parent will hang when writing into the pipe, because the child fd is not closed yet. The normal pattern is to close the child fds right after the child proc is forked/executed/spawned, so when the child dies, then also the pipes will be closed, and there will be no hang (the parent gets SIGPIPE instead). (cherry picked from commit 8ed5a2b) Co-authored-by: Albert Zeyer <albzey@gmail.com>
|
lkollar
pushed a commit
to lkollar/cpython
that referenced
this pull request
Sep 9, 2025
pythongh-118982) fix potential hang. It can happen that the child crashes right in the beginning for whatever reason. In this case, the parent will hang when writing into the pipe, because the child fd is not closed yet. The normal pattern is to close the child fds right after the child proc is forked/executed/spawned, so when the child dies, then also the pipes will be closed, and there will be no hang (the parent gets SIGPIPE instead).
encukou
pushed a commit
that referenced
this pull request
Oct 8, 2025
…ng (gh-118982) (GH-138605) fix potential hang. It can happen that the child crashes right in the beginning for whatever reason. In this case, the parent will hang when writing into the pipe, because the child fd is not closed yet. The normal pattern is to close the child fds right after the child proc is forked/executed/spawned, so when the child dies, then also the pipes will be closed, and there will be no hang (the parent gets SIGPIPE instead). (cherry picked from commit 8ed5a2b) Co-authored-by: Albert Zeyer <albzey@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fix gh-118981.
It can happen that the child crashes right in the beginning for whatever reason. In this case, the parent will hang when writing into the pipe, because the child fd is not closed yet.
The normal pattern is to close the child fds right after the child proc is forked/executed/spawned, so when the child dies, then also the pipes will get close, and there will be no hang (you get SIGPIPE instead).