diff options
author | Robert Guo <robert.guo@10gen.com> | 2019-07-01 18:00:47 -0400 |
---|---|---|
committer | Robert Guo <robert.guo@10gen.com> | 2019-07-03 13:11:32 -0400 |
commit | 60d7c98c0046f66422907e22e71118206b756c18 (patch) | |
tree | fa32d233ee7dc561ca49f1b7459097f2d2ad824a /buildscripts | |
parent | 3b297b76af902263445c21f65d4a432ec98e8fcd (diff) | |
download | mongo-60d7c98c0046f66422907e22e71118206b756c18.tar.gz |
SERVER-40702 wait for processes to exit on KeyboardInterrupt in resmoke
Diffstat (limited to 'buildscripts')
-rw-r--r-- | buildscripts/resmokelib/testing/executor.py | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/buildscripts/resmokelib/testing/executor.py b/buildscripts/resmokelib/testing/executor.py index ca8dc9a9d5b..21a1d12e128 100644 --- a/buildscripts/resmokelib/testing/executor.py +++ b/buildscripts/resmokelib/testing/executor.py @@ -196,12 +196,20 @@ class TestSuiteExecutor(object): # pylint: disable=too-many-instance-attributes except (KeyboardInterrupt, SystemExit): interrupt_flag.set() user_interrupted = True - else: - # Only wait for all the Job instances if not interrupted by the user. - self.logger.debug("Waiting for threads to complete") + + wait_secs = 2.0 + self.logger.debug("Waiting for threads to complete") + + timer = threading.Timer(wait_secs, self._log_timeout_warning, args=[wait_secs]) + timer.daemon = True + timer.start() + try: for thr in threads: thr.join() - self.logger.debug("Threads are completed!") + finally: + timer.cancel() + + self.logger.debug("Threads are completed!") reports = [job.report for job in self._jobs] combined_report = _report.TestReport.combine(*reports) @@ -316,3 +324,9 @@ class TestSuiteExecutor(object): # pylint: disable=too-many-instance-attributes queue.put(queue_elem) return queue + + def _log_timeout_warning(self, seconds): + """Log a message if any thread fails to terminate after `seconds`.""" + self.logger.warning( + '*** Still waiting for processes to terminate after %s seconds. Try using ctrl-\\ ' + 'to send a SIGQUIT on Linux or ctrl-c again on Windows ***', seconds) |