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() |