Skip to content

Commit eb700f8

Browse files
bpo-34040, multiprocessing: Fix test_forkserver_sigkill() (GH-8081)
Fix test_forkserver_sigkill() of test_multiprocessing_forkserver: give more time to the first child process to complete, double the sleep in the parent process. Reduce also the child process sleep from 1000 ms to 500 ms, to not change the total duration of the test. (cherry picked from commit 07888e1) Co-authored-by: Victor Stinner <[email protected]>
1 parent c1b75b5 commit eb700f8

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

‎Lib/test/_test_multiprocessing.py‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -651,13 +651,17 @@ def check_forkserver_death(self, signum):
651651
from multiprocessing.forkserver import _forkserver
652652
_forkserver.ensure_running()
653653

654+
# First process sleeps 500 ms
655+
delay = 0.5
656+
654657
evt = self.Event()
655-
proc = self.Process(target=self._sleep_and_set_event, args=(evt, 1.0))
658+
proc = self.Process(target=self._sleep_and_set_event, args=(evt, delay))
656659
proc.start()
657660

658661
pid = _forkserver._forkserver_pid
659662
os.kill(pid, signum)
660-
time.sleep(1.0) # give it time to die
663+
# give time to the fork server to die and time to proc to complete
664+
time.sleep(delay * 2.0)
661665

662666
evt2 = self.Event()
663667
proc2 = self.Process(target=self._sleep_and_set_event, args=(evt2,))

0 commit comments

Comments
 (0)