-
Notifications
You must be signed in to change notification settings - Fork 516
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
Stream error not handled correctly #108
Comments
When I handle
which is exactly what I observed in newrelic/node-newrelic#76 |
Maybe I misunderstood the statement "Bunyan re-emits error events from the created WriteStream". I guess it only refers to the file streams that Bunyan created itself, at least that's what the source says ( Line 372 in 06ade78
If that's the case, does that mean we should handle other stream errors (specifically stdout/stderr) separately? If I re-emit the error event for streams as well ( Line 363 in 06ade78
It would be really great to know, so that newrelic can handle the stdout error and exit gracefully. |
If this issue gets addressed, please let me know so I can fork and cherry-pick whatever chanes result. New Relic is version-locked to version 0.14.6 of Bunyan because I didn't want it to take the dependency on |
I'm also experiencing this. Whenever I kill nodemon, I get such errors from bunyan.
|
I'm also getting this error:
To recreate the error just uninstall bunyan then try and run the command. |
@basickarl did you install
Look at the second line of the error: |
I'm also getting |
@deadbeef84 The "This socket is closed" thing is in the |
It has been years, so I assume @Prinzhorn that you have moved on. :) Sorry for the delay. However, for completeness, and because I've been handling other EPIPE and exit-handling related Qs for bunyan of late (as I've improved in my understanding), I'll answer the OP here. Others on this thread, if you still have issues with the latest Bunyan, please open new tickets and I'll try to answer them there. Note that the issues are different with "bunyan the library" usage vs " At the time of the OP, the current version of bunyan was 0.22.0. Since then, the behaviour of EPIPE handling with bunyan the library has not changed. However, since then the Bunyan re-emitting of stream errors was initially added only for Bunyan streams of type=file. Writing to var bunyan = require('bunyan');
var log = bunyan.createLogger({
name: "myapp",
streams: [
{
stream: process.stdout,
reemitErrorEvents: true
}
]
});
setInterval(function() {
log.info("hi");
}, 500);
log.on('error', function(err, stream) {
process.exit(1);
}); Then it works as intended. In one terminal:
and in a second terminal:
|
It's late, so maybe I'm on the wrong track (I come from newrelic/node-newrelic#76).
Anyway, the documentation says
https://github.com/trentm/node-bunyan#stream-errors
Given this
index.js
and then piping the output to a named pipe created by
mkfifo mypipe
usingI get the following error when I close the pipe
Shouldn't the program just exit without an error? I do handle the error event.
The text was updated successfully, but these errors were encountered: