From 2771063062b8c6e7288c4846caf17bd6416d1f70 Mon Sep 17 00:00:00 2001 From: Daniel Mitterdorfer Date: Thu, 30 Jan 2020 15:54:33 +0100 Subject: [PATCH] Detach ES using Python standard mechanism (#884) With this commit we use the parameter `start_new_session` to detach Elasticsearch from its parent process group (Rally) instead of the problematic (and low-level) `preexec_fn`. Under the hood this will use the `setsid` system call instead of `setpgrp`. See also: * https://linux.die.net/man/2/setsid * https://linux.die.net/man/2/setpgrp Relates #859 --- esrally/mechanic/launcher.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/esrally/mechanic/launcher.py b/esrally/mechanic/launcher.py index c113f9f49..9e550e01b 100644 --- a/esrally/mechanic/launcher.py +++ b/esrally/mechanic/launcher.py @@ -192,12 +192,11 @@ def _set_env(self, env, k, v, separator=' ', prepend=False): def _run_subprocess(command_line, env): command_line_args = shlex.split(command_line) - # pylint: disable=subprocess-popen-preexec-fn with subprocess.Popen(command_line_args, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, env=env, - preexec_fn=os.setpgrp) as command_line_process: + start_new_session=True) as command_line_process: # wait for it to finish command_line_process.wait() return command_line_process.returncode