Commit 3a4a0235 authored by Clemens Backes's avatar Clemens Backes Committed by Commit Bot

[tools] Make killing of processes more robust

We spawn individual tests in their own shell, and then just kill that
shell later. This often leaves the tests running (see linked bugs).
By spawning the shell in its own new process group, we can just kill
that whole process group later, which seems to work reliably for hanging
tests.

R=machenbach@chromium.org

Bug: v8:8292, v8:8700
Change-Id: I6e38467d687cc0b395467d4b377644de7700f066
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2274634Reviewed-by: 's avatarMichael Achenbach <machenbach@chromium.org>
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#68634}
parent 5df74c35
......@@ -200,13 +200,17 @@ class PosixCommand(BaseCommand):
stderr=subprocess.PIPE,
env=self._get_env(),
shell=True,
# Make the new shell create its own process group. This allows to kill
# all spawned processes reliably (https://crbug.com/v8/8292).
preexec_fn=os.setsid,
)
except Exception as e:
sys.stderr.write('Error executing: %s\n' % self)
raise e
def _kill_process(self, process):
process.kill()
# Kill the whole process group (PID == GPID after setsid).
os.killpg(process.pid, signal.SIGKILL)
def taskkill_windows(process, verbose=False, force=True):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment