Bug 336193 - P2: Use a second SIGTERM in killPid() to ensure parent process is killed. draft
authorKestrel <kestrel@vmail.me>
Thu, 29 Mar 2018 19:23:51 +0800
changeset 774720 676773180d7e3c0a015d60961cf0f8e8f84b1a6c
parent 774719 fb5fbe6ced380e59a217f4c9f0f84f6558f23fe3
push id104477
push userbmo:kestrel@vmail.me
push dateThu, 29 Mar 2018 11:25:28 +0000
bugs336193
milestone61.0a1
Bug 336193 - P2: Use a second SIGTERM in killPid() to ensure parent process is killed. killPid() needs to do more than send a single SIGTERM to the parent process now that it only triggers graceful shutdown, sending a second SIGTERM terminates it forcefully like before. MozReview-Commit-ID: 6ZGTPYyHuqY
testing/mochitest/runtests.py
--- a/testing/mochitest/runtests.py
+++ b/testing/mochitest/runtests.py
@@ -335,16 +335,18 @@ def killPid(pid, log):
             children.append(parent)
             for p in children:
                 p.send_signal(signal.SIGTERM)
             gone, alive = psutil.wait_procs(children, timeout=30)
             for p in gone:
                 log.info('psutil found pid %s dead' % p.pid)
             for p in alive:
                 log.info('failed to kill pid %d after 30s' % p.pid)
+                # Try again, second SIGTERM is more forceful
+                p.send_signal(signal.SIGTERM)
         except Exception as e:
             log.info("Error: Failed to kill process %d: %s" % (pid, str(e)))
     else:
         try:
             os.kill(pid, getattr(signal, "SIGKILL", signal.SIGTERM))
         except Exception as e:
             log.info("Failed to kill process %d: %s" % (pid, str(e)))