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 23:25:12 +0000 |
commit | 94a8935df835b6fe4fabd898fd42fc09e0d4fdc6 (patch) | |
tree | 6dca3fdb065ba3f6f8593e435dc361b37ef19888 /buildscripts | |
parent | 735345972ec5a3c5c8ce70dbb07423807a1de506 (diff) | |
download | mongo-94a8935df835b6fe4fabd898fd42fc09e0d4fdc6.tar.gz |
SERVER-66080 SimulateCrash hook waits for mongod to stop before copying data files
(cherry picked from commit f121c23374f7d95717a4686033d034e056ac2198)
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.""" |