Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3410)

Unified Diff: remoting/host/linux/linux_me2me_host.py

Issue 635953002: Linux Chromoting: Explicitly kill all child processes on termination. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Send SIGKILL after timeout Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/host/linux/linux_me2me_host.py
diff --git a/remoting/host/linux/linux_me2me_host.py b/remoting/host/linux/linux_me2me_host.py
index 525af8c0aa480a75b0ba9d34610ef5a80da6a700..d6d17122c29fe405d8733e84b1ee43cc7df7e19b 100755
--- a/remoting/host/linux/linux_me2me_host.py
+++ b/remoting/host/linux/linux_me2me_host.py
@@ -780,9 +780,24 @@ def cleanup():
global g_desktops
for desktop in g_desktops:
- if desktop.x_proc:
- logging.info("Terminating Xvfb")
- desktop.x_proc.terminate()
+ for proc, name in [(desktop.x_proc, "Xvfb"),
+ (desktop.session_proc, "session"),
+ (desktop.host_proc, "host")]:
+ if proc is not None:
+ logging.info("Terminating " + name)
+ try:
+ psutil_proc = psutil.Process(proc.pid)
+ psutil_proc.terminate()
+
+ # Use a short timeout, to avoid delaying service shutdown if the
+ # process refuses to die for some reason.
+ psutil_proc.wait(timeout=10)
rmsousa 2014/10/10 00:50:27 This will serialize the process terminations on th
Lambros 2014/10/10 01:12:15 Nice idea, but probably too complicated to be wort
+ except psutil.TimeoutExpired:
+ logging.error("Timed out - sending SIGKILL")
+ psutil_proc.kill()
+ except psutil.Error:
+ logging.error("Error terminating process")
+
g_desktops = []
if ParentProcessLogger.instance():
ParentProcessLogger.instance().release_parent()
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698