Skip to content

Commit 5f1590d

Browse files
bpo-37531: regrtest main process uses shorter timeout (GH-16220) (GH-16224)
When using multiprocesss (-jN), the main process now uses a timeout of 60 seconds instead of the double of the --timeout value. The buildbot server stops a job which does not produce any output in 1200 seconds. (cherry picked from commit 46b0b81) Co-authored-by: Victor Stinner <[email protected]>
1 parent f668d2b commit 5f1590d

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

Lib/test/libregrtest/runtest_mp.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020

2121
# Display the running tests if nothing happened last N seconds
2222
PROGRESS_UPDATE = 30.0 # seconds
23+
assert PROGRESS_UPDATE >= PROGRESS_MIN_TIME
2324

2425
# Time to wait until a worker completes: should be immediate
2526
JOIN_TIMEOUT = 30.0 # seconds
@@ -305,10 +306,8 @@ def __init__(self, regrtest):
305306
self.pending = MultiprocessIterator(self.regrtest.tests)
306307
if self.ns.timeout is not None:
307308
self.worker_timeout = self.ns.timeout * 1.5
308-
self.main_timeout = self.ns.timeout * 2.0
309309
else:
310310
self.worker_timeout = None
311-
self.main_timeout = None
312311
self.workers = None
313312

314313
def start_workers(self):
@@ -345,12 +344,13 @@ def _get_result(self):
345344
except queue.Empty:
346345
return None
347346

347+
use_faulthandler = (self.ns.timeout is not None)
348+
timeout = PROGRESS_UPDATE
348349
while True:
349-
if self.main_timeout is not None:
350-
faulthandler.dump_traceback_later(self.main_timeout, exit=True)
350+
if use_faulthandler:
351+
faulthandler.dump_traceback_later(timeout * 2.0, exit=True)
351352

352353
# wait for a thread
353-
timeout = max(PROGRESS_UPDATE, PROGRESS_MIN_TIME)
354354
try:
355355
return self.output.get(timeout=timeout)
356356
except queue.Empty:
@@ -415,7 +415,7 @@ def run_tests(self):
415415
print()
416416
self.regrtest.interrupted = True
417417
finally:
418-
if self.main_timeout is not None:
418+
if self.ns.timeout is not None:
419419
faulthandler.cancel_dump_traceback_later()
420420

421421
# a test failed (and --failfast is set) or all tests completed

0 commit comments

Comments
 (0)