]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
gh-118981: multiprocessing.popen_spawn_posix, fix potential hang (gh-118982)
authorAlbert Zeyer <albzey@gmail.com>
Sun, 7 Sep 2025 07:18:28 +0000 (09:18 +0200)
committerGitHub <noreply@github.com>
Sun, 7 Sep 2025 07:18:28 +0000 (07:18 +0000)
commit8ed5a2b56cc6a8635e586c641b0b837669f6677b
treeb51c8d6f4c5a5202d110d86913340fd4df8d1f03
parentc117b033856ab7873972ec27bc1bfd2e1868bd47
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).
Lib/multiprocessing/popen_spawn_posix.py
Misc/NEWS.d/next/Library/2024-05-13-09-50-31.gh-issue-118981.zgOQPv.rst [new file with mode: 0644]