Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't read from stdout/stderr on ES startup #879

Merged
merged 2 commits into from
Jan 27, 2020

Conversation

danielmitterdorfer
Copy link
Member

With this commit we avoid reading from stdout/stderr which might have
been closed by the application and rely solely on the process' return
code.

Relates elastic/elasticsearch#50259

With this commit we avoid reading from stdout/stderr which might have
been closed by the application and rely solely on the process' return
code.

Relates elastic/elasticsearch#50259
@danielmitterdorfer danielmitterdorfer added enhancement Improves the status quo :Benchmark Candidate Management Anything affecting how Rally sets up Elasticsearch labels Jan 27, 2020
@danielmitterdorfer danielmitterdorfer added this to the 1.4.1 milestone Jan 27, 2020
@danielmitterdorfer danielmitterdorfer self-assigned this Jan 27, 2020
Copy link
Contributor

@dliappis dliappis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@danielmitterdorfer
Copy link
Member Author

@elasticmachine test this please

Copy link
Contributor

@drawlerr drawlerr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor comment on clearing up future confusion around mysterious Popen args.

def _run_subprocess(command_line, env):
command_line_args = shlex.split(command_line)

# pylint: disable=subprocess-popen-preexec-fn
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know we didn't comment this last time when this was added, but when going back over this code I completely forgot about why we have a preexec_fn. Seems an uncommonly used function that is prone to trouble as in the Pylint warning. Perhaps we can briefly comment why it is necessary for detached processes?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alternatively, we can "upgrade" to using the start_new_session argument described in https://docs.python.org/3.2/library/subprocess.html

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the feedback! As this is currently blocking our nightly benchmarks I'll merge this PR as is but this is definitely a good idea for a for a future PR. I'll keep this on my radar! :)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've pushed #884.

@danielmitterdorfer danielmitterdorfer merged commit 015d25f into elastic:master Jan 27, 2020
@danielmitterdorfer danielmitterdorfer deleted the es-startup branch January 29, 2020 15:49
DJRickyB pushed a commit that referenced this pull request Jul 27, 2022
This change uses the subprocess.run function introduced in Python 3.5 to check the subprocess and print its output to the console on failure. There is some background to why we do not do this currently in #879, but I believe the output is worthwhile, and at the time I think 3.5 was very recently our minimum Python version so this option may have been overlooked... or there may be a more technical reason I am missing.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Benchmark Candidate Management Anything affecting how Rally sets up Elasticsearch enhancement Improves the status quo
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants