Skip to content

Commit e2e02dd

Browse files
devdavidejesusmiss-islington
authored andcommitted
gh-160295: Fix race in test_forkserver_sigkill (GH-160296)
After a SIGKILL, the forkserver can no longer report the first child's exit status, so proc.join() returns with exit code 255 while the child may still be running. Wait for the event instead of checking it right after join(). (cherry picked from commit 40c8edd) Co-authored-by: Davi de Jesus <davidejesus.log@proton.me>
1 parent 1fa5e07 commit e2e02dd

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

‎Lib/test/_test_multiprocessing.py‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -972,7 +972,9 @@ def check_forkserver_death(self, signum):
972972
self.assertEqual(proc2.exitcode, 0)
973973

974974
proc.join()
975-
self.assertTrue(evt.is_set())
975+
# After SIGKILL, join() can return (exitcode 255) as soon as the
976+
# status pipe is closed, before the orphaned child has run.
977+
self.assertTrue(evt.wait(support.SHORT_TIMEOUT))
976978
self.assertIn(proc.exitcode, (0, 255))
977979

978980
def test_forkserver_sigint(self):

0 commit comments

Comments
 (0)