Unverified Commit a9c0e0c7 authored by Neelay Shah's avatar Neelay Shah Committed by GitHub
Browse files

fix: for handling zombie process (#1801)

parent c9a60278
......@@ -140,7 +140,7 @@ class ManagedProcess:
cmdline,
)
terminate_process_tree(ps_process.pid, self._logger)
except (psutil.NoSuchProcess, psutil.AccessDenied):
except (psutil.NoSuchProcess, psutil.AccessDenied, psutil.ZombieProcess):
# Process may have terminated or become inaccessible during iteration
pass
......@@ -256,21 +256,32 @@ class ManagedProcess:
def _terminate_existing(self):
if self.terminate_existing:
for proc in psutil.process_iter(["name", "cmdline"]):
if proc.name() == self._command_name or proc.name() in self.stragglers:
self._logger.info(
"Terminating Existing %s %s", proc.name(), proc.pid
)
terminate_process_tree(proc.pid, self._logger)
for cmdline in self.straggler_commands:
if cmdline in " ".join(proc.cmdline()):
try:
if (
proc.name() == self._command_name
or proc.name() in self.stragglers
):
self._logger.info(
"Terminating Existing CmdLine %s %s %s",
proc.name(),
proc.pid,
proc.cmdline(),
"Terminating Existing %s %s", proc.name(), proc.pid
)
terminate_process_tree(proc.pid, self._logger)
for cmdline in self.straggler_commands:
if cmdline in " ".join(proc.cmdline()):
self._logger.info(
"Terminating Existing CmdLine %s %s %s",
proc.name(),
proc.pid,
proc.cmdline(),
)
terminate_process_tree(proc.pid, self._logger)
except (
psutil.NoSuchProcess,
psutil.AccessDenied,
psutil.ZombieProcess,
):
# Process may have terminated or become inaccessible during iteration
pass
def main():
......
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