[Python-checkins] bpo-34040, multiprocessing: Fix test_forkserver_sigkill() (GH-8081)

Miss Islington (bot) webhook-mailer at python.org
Wed Jul 4 06:10:18 EDT 2018


https://github.com/python/cpython/commit/eb700f8c94602feb8c10ad8fc600f55e17e3b092
commit: eb700f8c94602feb8c10ad8fc600f55e17e3b092
branch: 3.7
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: GitHub <noreply at github.com>
date: 2018-07-04T03:10:14-07:00
summary:

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 07888e1cce89e9bb7dc501e287b4cb126e01c378)

Co-authored-by: Victor Stinner <vstinner at redhat.com>

files:
M Lib/test/_test_multiprocessing.py

diff --git a/Lib/test/_test_multiprocessing.py b/Lib/test/_test_multiprocessing.py
index 73321606f18b..a3891f1f04f5 100644
--- a/Lib/test/_test_multiprocessing.py
+++ b/Lib/test/_test_multiprocessing.py
@@ -651,13 +651,17 @@ def check_forkserver_death(self, signum):
         from multiprocessing.forkserver import _forkserver
         _forkserver.ensure_running()
 
+        # First process sleeps 500 ms
+        delay = 0.5
+
         evt = self.Event()
-        proc = self.Process(target=self._sleep_and_set_event, args=(evt, 1.0))
+        proc = self.Process(target=self._sleep_and_set_event, args=(evt, delay))
         proc.start()
 
         pid = _forkserver._forkserver_pid
         os.kill(pid, signum)
-        time.sleep(1.0)  # give it time to die
+        # give time to the fork server to die and time to proc to complete
+        time.sleep(delay * 2.0)
 
         evt2 = self.Event()
         proc2 = self.Process(target=self._sleep_and_set_event, args=(evt2,))



More information about the Python-checkins mailing list