forked from golang/glog
-
Notifications
You must be signed in to change notification settings - Fork 222
Resolved go routine leak in flush log function. #190
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
Closed
Closed
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
331ccab
Resolved go routine leak when flushing the logs after time interval
Himanshuxone bdca080
Resolved go routine leak
Himanshuxone eb16f3a
Merge branch 'master' into patch1
Himanshuxone 70c8bac
Resolved go routine leak
Himanshuxone 278b041
Merge branch 'master' into patch1
Himanshuxone File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This really seems like it will cause the logger to stop logging after 20 seconds (or so, when the stop channel is closed).
I'm wondering if what is really needed is a signal handler, but I worry a bit that adding a signal handler directly here would potentially lead to logging information being dropped too early.
I kind of wish that klog require explicit initialization rather than being done in init(), since then we could have the caller provide the stop channel and do the signal handling.
I'm not quite sure what the best path forward is from here, not sure if anyone else has some suggestions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @detiber , you got it right but I am sure that the piece of code before my change was not even working, the init() will exit before it get chance to flush the logs. There is no way the init() function is waiting for go routine flushing the logs. In my case the flush function will be called 4 times. Now question arise, that do we need to make a function which will work other than init().