Rotating-file stream prevent process from exiting.#97
Merged
trentm merged 1 commit intotrentm:masterfrom Jun 1, 2014
Merged
Conversation
Contributor
Author
|
Test case: https://gist.github.com/chakrit/6280041
|
Contributor
Author
|
whoops, hit the wrong button, sry. |
The rotation `setTimeout` from `RotatingFileStream` will prevent the process from exiting. This fix simply `unref()` the timeout immediately after it is set.
Contributor
Author
|
Found the solution, turns out it is simply because of the rotation Possibly also fix #73 as well but I havn't tested. |
Contributor
Author
|
@trentm any chance of this getting merged anytime soon? |
glenn-murray-bse
pushed a commit
to ascom-au/node-bunyan
that referenced
this pull request
Mar 4, 2014
Will fail if any timers or callbacks remain registered when instantiating a logger with a rotating file.
glenn-murray-bse
pushed a commit
to ascom-au/node-bunyan
that referenced
this pull request
Mar 4, 2014
glenn-murray-bse
pushed a commit
to ascom-au/node-bunyan
that referenced
this pull request
Mar 4, 2014
hajoeichler
added a commit
to sphereio/sphere-stock-sync
that referenced
this pull request
Mar 11, 2014
hajoeichler
added a commit
to sphereio/sphere-order-distribution
that referenced
this pull request
Mar 11, 2014
Owner
|
Thanks very much for finding the root issue here. I apologize for taking so long to get to this. This will be in bunyan 0.23.1. |
Owner
|
Hrm, the unref addition in the PR only fixes this for node 0.10. Node 0.8.x doesn't have unref on setTimeout results. I'll add a warning about rotating-file support for node 0.8. |
Contributor
Author
|
wow, that's a very long time! anyway glad it's finally fixed for good : ) awesome library btw. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related: #73
If I
bunyan.createLoggerwith atype: "rotating-file", my process will not exits.I've tried the solution in #73 but it does not work and my CLI program stays running even though it doesn't do anything.
Removing the rotating-file logger causes my very trivial program to exit cleanly.
Is there a way to force the logger to close all streams?
This is also very problematic in tests as having a component using the rotating-file logger means the test will not cleanup properly or the test runner may not exit and hangs the CI :/