Commit 46b0b812 authored by Victor Stinner's avatar Victor Stinner Committed by GitHub

bpo-37531: regrtest main process uses shorter timeout (GH-16220)

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.
parent 5d359cc6
...@@ -20,6 +20,7 @@ from test.libregrtest.utils import format_duration ...@@ -20,6 +20,7 @@ from test.libregrtest.utils import format_duration
# Display the running tests if nothing happened last N seconds # Display the running tests if nothing happened last N seconds
PROGRESS_UPDATE = 30.0 # seconds PROGRESS_UPDATE = 30.0 # seconds
assert PROGRESS_UPDATE >= PROGRESS_MIN_TIME
# Time to wait until a worker completes: should be immediate # Time to wait until a worker completes: should be immediate
JOIN_TIMEOUT = 30.0 # seconds JOIN_TIMEOUT = 30.0 # seconds
...@@ -305,10 +306,8 @@ class MultiprocessRunner: ...@@ -305,10 +306,8 @@ class MultiprocessRunner:
self.pending = MultiprocessIterator(self.regrtest.tests) self.pending = MultiprocessIterator(self.regrtest.tests)
if self.ns.timeout is not None: if self.ns.timeout is not None:
self.worker_timeout = self.ns.timeout * 1.5 self.worker_timeout = self.ns.timeout * 1.5
self.main_timeout = self.ns.timeout * 2.0
else: else:
self.worker_timeout = None self.worker_timeout = None
self.main_timeout = None
self.workers = None self.workers = None
def start_workers(self): def start_workers(self):
...@@ -345,12 +344,13 @@ class MultiprocessRunner: ...@@ -345,12 +344,13 @@ class MultiprocessRunner:
except queue.Empty: except queue.Empty:
return None return None
use_faulthandler = (self.ns.timeout is not None)
timeout = PROGRESS_UPDATE
while True: while True:
if self.main_timeout is not None: if use_faulthandler:
faulthandler.dump_traceback_later(self.main_timeout, exit=True) faulthandler.dump_traceback_later(timeout * 2.0, exit=True)
# wait for a thread # wait for a thread
timeout = max(PROGRESS_UPDATE, PROGRESS_MIN_TIME)
try: try:
return self.output.get(timeout=timeout) return self.output.get(timeout=timeout)
except queue.Empty: except queue.Empty:
...@@ -415,7 +415,7 @@ class MultiprocessRunner: ...@@ -415,7 +415,7 @@ class MultiprocessRunner:
print() print()
self.regrtest.interrupted = True self.regrtest.interrupted = True
finally: finally:
if self.main_timeout is not None: if self.ns.timeout is not None:
faulthandler.cancel_dump_traceback_later() faulthandler.cancel_dump_traceback_later()
# a test failed (and --failfast is set) or all tests completed # a test failed (and --failfast is set) or all tests completed
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment