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

logs.go: fixed logger creation #4254

Closed
wants to merge 1 commit into from

Conversation

AntonMoryakov
Copy link

Previously, the done channel was not closed properly in case of an error returned by logPipe.Close(), potentially leading to a goroutine leak. This commit ensures that the done channel is closed even if there's an error during the closing of logPipe.

Previously, the done channel was not closed properly in case of an error returned by logPipe.Close(), potentially leading to a goroutine leak. This commit ensures that the done channel is closed even if there's an error during the closing of logPipe.

Signed-off-by: Anton <ant.v.moryakov@gmail.com>
Copy link
Contributor

@kolyshkin kolyshkin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Wonder how have you found this @AntonMoryakov ?

@lifubang
Copy link
Member

the done channel was not closed properly in case of an error returned by logPipe.Close()

I think we have catched the error returned by logPipe.Close(), so I think the done channel will be closed in any case.

if err := logPipe.Close(); err != nil {
logrus.Errorf("error closing log source: %v", err)
}

Yes, but I think it will be better to move it to defer func. Thanks.

@kolyshkin
Copy link
Contributor

the done channel was not closed properly in case of an error returned by logPipe.Close()

I think we have catched the error returned by logPipe.Close(), so I think the done channel will be closed in any case.

if err := logPipe.Close(); err != nil {
logrus.Errorf("error closing log source: %v", err)
}

Hmm you are right (not sure how I overlooked it).

So, while defer is indeed better, there's nothing to fix here. For this reason, I'd rather not merge this.

Copy link
Contributor

@kolyshkin kolyshkin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As pointed out above, there's nothing to fix here.

Or, at the very least, the description needs to be changed.

@kolyshkin
Copy link
Contributor

@AntonMoryakov can you comment on #4254 (comment)?

@kolyshkin
Copy link
Contributor

Closing for now; will reopen depending on the PR author response.

@kolyshkin kolyshkin closed this May 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants