"lib/bindings/python/vscode:/vscode.git/clone" did not exist on "a337113aa984a882886bef7e407e0956bdec5174"
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: ...@@ -140,7 +140,7 @@ class ManagedProcess:
cmdline, cmdline,
) )
terminate_process_tree(ps_process.pid, self._logger) 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 # Process may have terminated or become inaccessible during iteration
pass pass
...@@ -256,7 +256,11 @@ class ManagedProcess: ...@@ -256,7 +256,11 @@ class ManagedProcess:
def _terminate_existing(self): def _terminate_existing(self):
if self.terminate_existing: if self.terminate_existing:
for proc in psutil.process_iter(["name", "cmdline"]): for proc in psutil.process_iter(["name", "cmdline"]):
if proc.name() == self._command_name or proc.name() in self.stragglers: try:
if (
proc.name() == self._command_name
or proc.name() in self.stragglers
):
self._logger.info( self._logger.info(
"Terminating Existing %s %s", proc.name(), proc.pid "Terminating Existing %s %s", proc.name(), proc.pid
) )
...@@ -271,6 +275,13 @@ class ManagedProcess: ...@@ -271,6 +275,13 @@ class ManagedProcess:
proc.cmdline(), proc.cmdline(),
) )
terminate_process_tree(proc.pid, self._logger) 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(): 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