Skip to content

Commit b6ae309

Browse files
gh-160295: Fix race in test_forkserver_sigkill
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().
1 parent 1705e51 commit b6ae309

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

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

10001002
def test_forkserver_sigint(self):

0 commit comments

Comments
 (0)