Merged
Conversation
Member
|
@C-Pro hi, many thanks! I think it's a reasonable fix, and it should cover other possible races as well. Should be OK behaviour-wise since client is unusable after close. As you noticed, made a separate PR with a couple of adjustments. |
Contributor
Author
|
My concern of not executing callbacks is that users may rely on it to be guaranteed. E.g. incrementing metric on subscribe and decrementing on unsubscribe will lead to something resembling "leaking" subscriptions if on unsubscribe callback is sometimes lost. |
Member
|
Generally callbacks still should be called, whether by |
FZambia
added a commit
that referenced
this pull request
Jun 22, 2025
Co-authored-by: Sergey Melekhin <[email protected]>
Member
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.
I have encountered a panic in production, I believe it happened when some kind of network error happened concurrently with normal
client.Close()on a client that had some callbacks in the queue.My theory is that
client.Closesetc.cbQueue = nilat the same time asclient.handleDisconnectrunning in a goroutine attempted to push to the queue. This is how test fails before my "fix":I am not sure that my "fix" is a proper one though, as callbacks won't be run in case
Closehas happened before.I suspect there is a better solution.