-
Notifications
You must be signed in to change notification settings - Fork 1.5k
fix(spanner): fix createMultiplexedSession goroutine leak #13396
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1067,6 +1067,7 @@ func (p *sessionPool) close(ctx context.Context) { | |
| } | ||
| p.mu.Unlock() | ||
| p.hc.close() | ||
| close(p.multiplexedSessionReq) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This change would get lost if we remove the entire
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think the property that should be enforced is that all started goroutines are stopped. If the channels is left open and no one is using it, then it probably doesn't matter. Using synctest seems a good fit for this. However, it does require Go 1.25 or 1.24 with GOEXPERIMENT=synctest. I wouldn't want to bump minimum language version requirement just for that... however the test could be put behind build tag.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I created a draft for that test, however it fails at the moment #13406. Need to diagnose the issue, might require some additional fixes.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. SG. I didn't really realize that the entire multiplexed session implementation lives in the session pool, so my comment that this call should be moved to outside the pool does not really make any sense.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I managed to fix #13406 and it succeeds when this PR is merged. However, the mock server still leaks, which I excluded from the check. |
||
| // destroy all the sessions | ||
| p.hc.mu.Lock() | ||
| allSessions := make([]*session, len(p.hc.queue.sessions)) | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.