[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/+/2274634 Reviewed-by: Michael Achenbach <machenbach@chromium.org> Commit-Queue: Clemens Backes <clemensb@chromium.org> Cr-Commit-Position: refs/heads/master@{#68634}
This commit is contained in:
parent
5df74c351f
commit
3a4a0235c5
@ -200,13 +200,17 @@ class PosixCommand(BaseCommand):
|
|||||||
stderr=subprocess.PIPE,
|
stderr=subprocess.PIPE,
|
||||||
env=self._get_env(),
|
env=self._get_env(),
|
||||||
shell=True,
|
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:
|
except Exception as e:
|
||||||
sys.stderr.write('Error executing: %s\n' % self)
|
sys.stderr.write('Error executing: %s\n' % self)
|
||||||
raise e
|
raise e
|
||||||
|
|
||||||
def _kill_process(self, process):
|
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):
|
def taskkill_windows(process, verbose=False, force=True):
|
||||||
|
Loading…
Reference in New Issue
Block a user