Skip to content

Commit

Permalink
Detach ES using Python standard mechanism (#884)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
danielmitterdorfer committed Jan 30, 2020
1 parent f145325 commit 2771063
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions esrally/mechanic/launcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 2771063

Please sign in to comment.