Skip to content

Conversation

miss-islington
Copy link
Contributor

@miss-islington miss-islington commented Sep 7, 2025

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

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>
@gpshead gpshead enabled auto-merge (squash) September 7, 2025 07:35
@gpshead gpshead merged commit 612b535 into python:3.13 Sep 7, 2025
44 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants