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

balancergroup: fix leak child balancer not closed #4308

Merged
merged 3 commits into from Apr 6, 2021

Conversation

menghanl
Copy link
Contributor

Child policies in balancergroup are put into a cache when they are removed (and will be closed later after a timeout).
When balancergroup is closed, we clear the cache, so that child policies will be immediately closed.

Before this change, we first mark balancergroup as closed (bg.outgoingStarted = false), then clear the cache (bg.balancerCache.Clear(true)). This makes the cache clear a noop, so the child in cache will be leaked.

This change moves cache.Clear before marking balancergroup as closed.

@menghanl menghanl added this to the 1.38 Release milestone Mar 31, 2021
// Immediately close balancergroup, before the cache timeout
bg.Close()

// Make sure the remove child balancer is closed.
Copy link
Member

Choose a reason for hiding this comment

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

Nit: s/remove/removed/ (or remove remove?)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@menghanl menghanl merged commit 9a10f35 into grpc:master Apr 6, 2021
@menghanl menghanl deleted the balancergroup_leak_child branch April 6, 2021 20:11
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 4, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants