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

Explicitly close HTTP server to avoid process.exit #42

Merged
merged 1 commit into from
Dec 1, 2017

Conversation

orangejulius
Copy link
Member

@orangejulius orangejulius commented Oct 24, 2017

Using process.exit directly can cause output to stderr/stdout to be truncated, since it does not wait for output to streams to be sent.

This probably isn't an issue here for the PIP service, but it's worth avoiding it since explicitly closing the HTTP server created by express is easy, and will cause the process to quit "naturally", as nothing else
is running.

We did actually run into this issue in the fuzzy-tester and it's a pain to track down.

Using `process.exit` directly can cause output to stderr/stdout to be
truncated, since it
[does not wait for output to streams to be sent](https://nodejs.org/api/process.html#process_process_exit_code).

This probably isn't an issue here for the PIP service, but it's worth
avoiding it since explicitly closing the HTTP server created by express
is easy, and will cause the process to quit "naturally", as nothing else
is running.

We did actually run into this issue in the [fuzzy-tester](pelias/fuzzy-tester#44)
and it's a pain to track down.
@orangejulius orangejulius merged commit 766da53 into master Dec 1, 2017
@ghost ghost removed the in review label Dec 1, 2017
@orangejulius orangejulius deleted the avoid-process.exit branch December 1, 2017 18:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants