Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid trying to kill a node twice to prevent orphaned processes. #1232

Merged
merged 2 commits into from
Jun 6, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion tests/TestHarness/Node.py
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ def kill(self, killSignal):
if self.popenProc is not None:
self.popenProc.send_signal(killSignal)
self.popenProc.wait()
else:
elif self.pid is not None:
os.kill(self.pid, killSignal)

# wait for kill validation
Expand All @@ -286,6 +286,8 @@ def myFunc():
if not Utils.waitForBool(myFunc):
Utils.Print("ERROR: Failed to validate node shutdown.")
return False
else:
if Utils.Debug: Utils.Print(f"Called kill on node {self.nodeId} but it has already exited.")
except OSError as ex:
Utils.Print("ERROR: Failed to kill node (%s)." % (self.cmd), ex)
return False
Expand Down Expand Up @@ -377,6 +379,7 @@ def relaunch(self, chainArg=None, newChain=False, skipGenesis=True, timeout=Util
if chainArg:
cmdArr.extend(shlex.split(chainArg))
self.popenProc=self.launchCmd(cmdArr, self.data_dir, launch_time=datetime.now().strftime('%Y_%m_%d_%H_%M_%S'))
self.pid=self.popenProc.pid

def isNodeAlive():
"""wait for node to be responsive."""
Expand Down