fix(go): close failed session event loops - #2360
Open
green3sf wants to merge 1 commit into
Open
Conversation
green3sf
marked this pull request as ready for review
August 19, 2026 12:43
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.
Summary
CreateSessionfailssession.destroyRPCRoot cause
newSessionstartsprocessEventsimmediately. The affected error paths removed the pre-registered session fromClient.sessionsbut left its event channel open. Because the failed session was neither returned to the caller nor retained forClient.Stop, its goroutine remained blocked on the channel for the lifetime of the process.The cleanup now removes only the session instance created by the failing call and closes its event channel without making another RPC.
Impact
Failed non-cloud session creation no longer leaks one goroutine, session object, and buffered event channel per attempt.
Validation
go test .go test -race . -run 'TestClient_CreateSession(Failure|InitializationFailure)ClosesRegisteredSession' -count=1git diff --checkFixes #2320