Skip to content

Commit 1f4af99

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 e243e46 commit 1f4af99

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
@@ -993,7 +993,9 @@ def check_forkserver_death(self, signum):
993993
self.assertEqual(proc2.exitcode, 0)
994994

995995
proc.join()
996-
self.assertTrue(evt.is_set())
996+
# After SIGKILL, join() can return (exitcode 255) as soon as the
997+
# status pipe is closed, before the orphaned child has run.
998+
self.assertTrue(evt.wait(support.SHORT_TIMEOUT))
997999
self.assertIn(proc.exitcode, (0, 255))
9981000

9991001
def test_forkserver_sigint(self):

0 commit comments

Comments
 (0)