Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 26f9268

Browse files
committed
Stop trying to use strace, but add a sleep before terminate().
1 parent 86823a5 commit 26f9268

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

Lib/test/_test_multiprocessing.py

+4-8
Original file line numberDiff line numberDiff line change
@@ -300,12 +300,14 @@ def test_terminate(self):
300300
self.assertTimingAlmostEqual(join.elapsed, 0.0)
301301
self.assertEqual(p.is_alive(), True)
302302

303+
# XXX maybe terminating too soon causes the problems on Gentoo...
304+
time.sleep(1)
305+
303306
p.terminate()
304307

305308
if hasattr(signal, 'alarm'):
306309
# On the Gentoo buildbot waitpid() often seems to block forever.
307-
# We use alarm() to interrupt it if it blocks for too long, and
308-
# then try to print a backtrace for the child process using gdb.
310+
# We use alarm() to interrupt it if it blocks for too long.
309311
def handler(*args):
310312
raise RuntimeError('join took too long: %s' % p)
311313
old_handler = signal.signal(signal.SIGALRM, handler)
@@ -315,12 +317,6 @@ def handler(*args):
315317
signal.alarm(0)
316318
except RuntimeError:
317319
print('os.waitpid() =', os.waitpid(p.pid, os.WNOHANG))
318-
import subprocess
319-
try:
320-
subprocess.check_call(['strace', '-p', str(p.pid)],
321-
timeout=10)
322-
except subprocess.TimeoutExpired:
323-
pass
324320
raise
325321
finally:
326322
signal.signal(signal.SIGALRM, old_handler)

0 commit comments

Comments
 (0)