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