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>
@encukou encukou merged commit 3013683 into python:3.14 Oct 8, 2025
46 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.

5 participants