]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
[3.14] gh-118981: multiprocessing.popen_spawn_posix, fix potential hang (gh-118982...
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Wed, 8 Oct 2025 12:22:05 +0000 (14:22 +0200)
committerGitHub <noreply@github.com>
Wed, 8 Oct 2025 12:22:05 +0000 (14:22 +0200)
commit3013683e9962f5f7f0915ed6c94a551dc396b8ac
tree7adc8cf3e8e718fbae79cc9c096425bf044387bc
parent32233d68d842e96130656fb30caabe53669b98e7
[3.14] gh-118981: multiprocessing.popen_spawn_posix, fix potential hang (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 8ed5a2b56cc6a8635e586c641b0b837669f6677b)

Co-authored-by: Albert Zeyer <albzey@gmail.com>
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]