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

Unified Diff: build/android/pylib/utils/test_environment.py

Issue 105733013: Android: kill leftover webpagereplay servers. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Comments Created 7 years 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: build/android/pylib/utils/test_environment.py
diff --git a/build/android/pylib/utils/test_environment.py b/build/android/pylib/utils/test_environment.py
index 279bc4a135c6acb043712a4c3d37425029ebaf13..627c2ddf97f863d1b92d7b350d85633cdea75c6d 100644
--- a/build/android/pylib/utils/test_environment.py
+++ b/build/android/pylib/utils/test_environment.py
@@ -5,19 +5,30 @@
import logging
import os
import psutil
+import signal
from pylib import android_commands
+
def _KillWebServers():
- for retry in xrange(5):
- for server in ['lighttpd', 'web-page-replay']:
- pids = [p.pid for p in psutil.process_iter() if server in p.name]
- for pid in pids:
+ for s in [signal.SIGTERM, signal.SIGINT, signal.SIGQUIT, signal.SIGKILL]:
+ signalled = []
+ for server in ['lighttpd', 'webpagereplay']:
+ for p in psutil.process_iter():
try:
- logging.warning('Killing %s %s', server, pid)
- os.kill(pid, signal.SIGQUIT)
+ if not server in ' '.join(p.cmdline):
+ continue
+ logging.info('Killing %s %s %s', s, server, p.pid)
+ p.send_signal(s)
+ signalled.append(p)
except Exception as e:
- logging.warning('Failed killing %s %s %s', server, pid, e)
+ logging.warning('Failed killing %s %s %s', server, p.pid, e)
+ for p in signalled:
+ try:
+ p.wait(1)
+ except Exception as e:
+ logging.warning('Failed waiting for %s to die. %s', p.pid, e)
+
def CleanupLeftoverProcesses():
« 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