Bug 1233664 - talos failure when firefox exit code is not detected. r=jmaher
authorJulien Pagès <j.parkouss@gmail.com>
Fri, 18 Dec 2015 12:22:55 +0100
changeset 277015 e8b9203ad41efd4b07d07cd52cd1befcab953b9f
parent 277014 4776a775d587ec89a08e79e74c75b96073f98b88
child 277016 9b4445c0f2023fdd8bad1dcac239baa9aeb87348
push id16724
push usercbook@mozilla.com
push dateMon, 21 Dec 2015 11:00:52 +0000
treeherderfx-team@3f3f0361567c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjmaher
bugs1233664
milestone46.0a1
Bug 1233664 - talos failure when firefox exit code is not detected. r=jmaher
testing/talos/talos/talos_process.py
--- a/testing/talos/talos/talos_process.py
+++ b/testing/talos/talos/talos_process.py
@@ -23,25 +23,29 @@ class ProcessContext(object):
         self.output = None
         self.process = None
 
     @property
     def pid(self):
         return self.process and self.process.pid
 
     def kill_process(self):
+        """
+        Kill the process, returning the exit code or None if the process
+        is already finished.
+        """
         if self.process and self.process.is_running():
             LOG.debug("Terminating %s" % self.process)
             self.process.terminate()
             try:
-                self.process.wait(3)
+                return self.process.wait(3)
             except psutil.TimeoutExpired:
                 self.process.kill()
                 # will raise TimeoutExpired if unable to kill
-                self.process.wait(3)
+                return self.process.wait(3)
 
 
 class Reader(object):
     def __init__(self, event):
         self.output = []
         self.got_end_timestamp = False
         self.got_timeout = False
         self.timeout_message = ''
@@ -120,21 +124,25 @@ def run_browser(command, minidump_dir, t
                     "Browser shutdown timed out after {0} seconds, terminating"
                     " process.".format(wait_for_quit_timeout)
                 )
         elif reader.got_timeout:
             raise TalosError('TIMEOUT: %s' % reader.timeout_message)
     finally:
         # this also handle KeyboardInterrupt
         # ensure early the process is really terminated
-        context.kill_process()
-        return_code = proc.wait(1)
+        return_code = context.kill_process()
+        if return_code is None:
+            return_code = proc.wait(1)
 
     reader.output.append(
         "__startBeforeLaunchTimestamp%d__endBeforeLaunchTimestamp"
         % first_time)
     reader.output.append(
         "__startAfterTerminationTimestamp%d__endAfterTerminationTimestamp"
         % (int(time.time()) * 1000))
 
-    LOG.process_exit(proc.pid, return_code)
+    if return_code is not None:
+        LOG.process_exit(proc.pid, return_code)
+    else:
+        LOG.debug("Unable to detect exit code of the process %s." % proc.pid)
     context.output = reader.output
     return context