-
Notifications
You must be signed in to change notification settings - Fork 214
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
go routine created on flush logs leaks #282
Comments
I also saw this recently when debugging unit tests for #107372
|
Starting a goroutine in init looks really bad to me. This should be under the control of the user of the package. I recently fixed flushing in Kubernetes and had no idea that klog was also doing it internally :sad: @dims do you think we can move that out of |
Perhaps there is a way to solve this without breaking users who currently expect automatic flushing. Flushing only does anything when createFiles is called, because that is the only place where syncBuffer is created: Lines 1267 to 1285 in e7e4115
Without syncBuffer, there's nothing that needs to be flushed. In particular, SetOutput writes without buffering: Lines 984 to 994 in e7e4115
That means that we can move the flush daemon startup from init into createFiles: Line 420 in e7e4115
Of course it must only be started once. An API for stopping and waiting for it to stop can be added as an API extension at the same time. Anyone willing to prepare a PR? /help-wanted |
/help |
Not sure if this is a good fist issue, but I will give it a try. Is there any way to test klog locally? |
|
/kind bug
What steps did you take and what happened:
uber/goleak found a leaking goroutine during test run:
Previous mentioned in #188.
#190 tried to fix this.
I'm opening a new issue since both are closed now but the problem still exists.
The text was updated successfully, but these errors were encountered: