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

Fix truncation errors #44

Merged
merged 2 commits into from
Apr 4, 2016
Merged

Fix truncation errors #44

merged 2 commits into from
Apr 4, 2016

Conversation

orangejulius
Copy link
Member

The output from the fuzzy-tester is sometimes truncated, it turns out process.exit is unsafe to use just after a bunch of big console.logs. Instead process.exitCode should be used. See these Node.js issues:

nodejs/node#3669
nodejs/node#3170
nodejs/node#2972 (comment)

Note: after this is merged I'm going to backport it to the 0.5 branch and release 0.5.2 to be used with our acceptance tests right away Update: it doesn't need to be backported afterall!

`console.error` does not always have the same buffering settings as
`console.log` and so printing to both does not always cause output to be
shown in the intended order. `console.error` should only be used for
real errors that happen elsewhere.
`process.exit` quits immediately, without allowing buffered output from
say, a `console.log` to be printed. See these Node.js issues:

nodejs/node#3669
nodejs/node#3170
nodejs/node#2972 (comment)
@orangejulius orangejulius self-assigned this Apr 4, 2016
@trescube
Copy link
Contributor

trescube commented Apr 4, 2016

👍

@orangejulius orangejulius merged commit 783c2bc into master Apr 4, 2016
@orangejulius orangejulius deleted the fix_truncation_errors branch May 23, 2016 20:42
orangejulius added a commit to pelias/pip-service that referenced this pull request 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](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 added a commit to pelias/pip-service that referenced this pull request 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](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 added a commit to pelias/pip-service that referenced this pull request Dec 1, 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](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.
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.

2 participants