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

Unified Diff: scripts/slave/recipe_modules/goma/resources/cloudtail_utils.py

Issue 2430123002: Use signal.SIGTERM instead of signal.SIGKILL to kill process. (Closed)
Patch Set: Created 4 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: scripts/slave/recipe_modules/goma/resources/cloudtail_utils.py
diff --git a/scripts/slave/recipe_modules/goma/resources/cloudtail_utils.py b/scripts/slave/recipe_modules/goma/resources/cloudtail_utils.py
index f5193384b1fcca080984195acf02f9073456cbba..b1edbbd621b5490dc8a985db6d30f17271ae3792 100644
--- a/scripts/slave/recipe_modules/goma/resources/cloudtail_utils.py
+++ b/scripts/slave/recipe_modules/goma/resources/cloudtail_utils.py
@@ -66,14 +66,17 @@ def wait_termination(pid):
NotDiedError is raised.
"""
+ # TODO(yyanagisawa): need to handle the case cloudtail is not running?
os.kill(pid, signal.SIGINT)
+ print('SIGINT has been sent to process %d. '
+ 'Going to wait for the process finishes.' % pid)
if os.name == 'nt':
try:
os.waitpid(pid, 0)
except OSError as e:
if e.errno == errno.ECHILD:
- print('process of pid %d died before waitpitd' % pid)
+ print('process %d died before waitpitd' % pid)
return
raise e
else:
@@ -115,12 +118,14 @@ def main():
# cloudtail flushes log and terminates
# within 5 seconds when it recieves SIGINT.
pid = int(f.read())
- try:
- wait_termination(pid)
- except (OSError, NotDiedError) as e:
- os.kill(pid, signal.SIGKILL)
- print('killed process %d due to Error %s' % (pid, e))
- raise e
+ try:
+ wait_termination(pid)
+ except (OSError, NotDiedError) as e:
+ print('Going to send SIGTERM to process %d due to Error %s' % (pid, e))
+ # Since Windows does not have SIGKILL, we need to use SIGTERM.
+ os.kill(pid, signal.SIGTERM)
ukai 2016/10/19 04:16:27 cloudtail doesn't handle SIGTERM to process someth
Yoshisato Yanagisawa 2016/10/19 04:27:24 It seems not? https://chromium.googlesource.com/i
+ # We do not reraise because I believe not suspending the process
+ # is more important than completely killing cloudtail.
if '__main__' == __name__:
« 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