-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
fix registering broker on closed client #1622
Conversation
Thanks for contributing. Could you please sign CLA (see link in GitHub Checks list right below this comment)? |
f9ad718
to
69da84b
Compare
69da84b
to
146b4c7
Compare
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.
@clitetailor thanks for your PR. The changes look reasonable, essentially checking again (after taking the write lock) that brokers
is still non-nil before proceeding. It would be helpful if you could also add the panic stacktrace you were seeing into the description of the issue.
I wasn't sure why you'd chosen to remove the up-front read-locking if client.Closed() { return }
check in the updateMetadata
func, but left it in-place in the RefreshCoordinator
func? It's also a change in behaviour as updateMetadata
was previously returning false, nil
when client.brokers was nil at entrypoint. Is that change intentional?
Hi @dnwe, thanks for your reply. Sorry cause i don't hold the code so i can't give you the stacktrace until next week but i can tell that the stacktrace is the same as described in #1531.
I remove the up-front check because i feel it's quite redundant to lock and check twice on the same condition. I don't remove it in
I see that What do you think? Do you have any suggestion? |
@dnwe FYI, here is my stacktrace:
|
146b4c7
to
4a36fb3
Compare
It seems like the problem has been fixed already. I will reopen if any furthur problem encountered. Thanks for creating a great library! |
When i try to close sarama client i got the same error as #1531
As i understand this is a simple check-then-act race condition. Did i handle error correctly?!