]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
[3.13] gh-118981: multiprocessing.popen_spawn_posix, fix potential hang (gh-118982...
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Sun, 7 Sep 2025 07:41:54 +0000 (09:41 +0200)
committerGitHub <noreply@github.com>
Sun, 7 Sep 2025 07:41:54 +0000 (07:41 +0000)
commit612b535e6d7b7cf26d86d895aeb793ab2c28c9d4
tree8dde229a548ebf3f286ce52bb0e008f7aaef9ac2
parent837df2774fe416158359b1e09c0eef840e691617
[3.13] gh-118981: multiprocessing.popen_spawn_posix, fix potential hang (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 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]