diff options
author | Gregory Wlodarek <gregory.wlodarek@mongodb.com> | 2022-04-29 03:30:02 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2022-04-29 20:59:54 +0000 |
commit | f121c23374f7d95717a4686033d034e056ac2198 (patch) | |
tree | b41d076a95d9b67671be77bcb90093a15b730d90 /buildscripts | |
parent | 0a4b53d09829f7141dee359ba12df24d4bcddf09 (diff) | |
download | mongo-f121c23374f7d95717a4686033d034e056ac2198.tar.gz |
SERVER-66080 SimulateCrash hook waits for mongod to stop before copying data files
Diffstat (limited to 'buildscripts')
-rw-r--r-- | buildscripts/resmokelib/core/process.py | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/buildscripts/resmokelib/core/process.py b/buildscripts/resmokelib/core/process.py index c749663b979..1e22aa532a3 100644 --- a/buildscripts/resmokelib/core/process.py +++ b/buildscripts/resmokelib/core/process.py @@ -12,9 +12,11 @@ import signal import subprocess import sys import threading +import time from datetime import datetime from shlex import quote +import psutil from buildscripts.resmokelib import config as _config from buildscripts.resmokelib import errors from buildscripts.resmokelib import utils @@ -278,8 +280,15 @@ class Process(object): return " ".join(sb) def pause(self): - """Send the SIGSTOP signal to the process.""" - self._process.send_signal(signal.SIGSTOP) + """Send the SIGSTOP signal to the process and wait for it to be stopped.""" + while True: + self._process.send_signal(signal.SIGSTOP) + mongod_process = psutil.Process(self.pid) + process_status = mongod_process.status() + if process_status == psutil.STATUS_STOPPED: + break + self.logger.info("Process status: {}".format(process_status)) + time.sleep(1) def resume(self): """Send the SIGCONT signal to the process.""" |