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

Fix alias check leak #14935

Merged
merged 2 commits into from Oct 13, 2022
Merged

Fix alias check leak #14935

merged 2 commits into from Oct 13, 2022

Conversation

freddygv
Copy link
Contributor

@freddygv freddygv commented Oct 10, 2022

Description

Preivously when alias check was removed it would not be stopped nor cleaned up from the associated aliasChecks map.

This means that any time an alias check was deregistered we would leak a goroutine for CheckAlias.run() because the stopCh would never be closed.

This issue comes up then the sidecar_service stanza is used, as documented here. When services are registered this way without custom health checks it leads to adding an alias check, which makes the sidecar service reflect the health of the underlying service.

The issue can lead to large goroutine counts in service mesh deployments on platforms where the client agent is mostly static but proxy services come and go regularly.

Testing & Reproduction steps

  • Noticed leak in a goroutine profile, which had over a thousand goroutines in CheckAlias.run() but there were only about a dozen services.
  • Confirmed behavior with the unit test added, which initially failed.

PR Checklist

  • updated test coverage
  • external facing docs updated
  • not a security concern

Preivously when alias check was removed it would not be stopped nor
cleaned up from the associated aliasChecks map.

This means that any time an alias check was deregistered we would
leak a goroutine for CheckAlias.run() because the stopCh would never
be closed.

This issue mostly affects service mesh deployments on platforms where
the client agent is mostly static but proxy services come and go
regularly, since by default sidecars are registered with an alias check.
@freddygv freddygv requested review from a team and boxofrad and removed request for a team October 10, 2022 22:53
@rboyer
Copy link
Member

rboyer commented Oct 11, 2022

Should this have any backports?

@freddygv freddygv added backport/1.12 Changes are backported to 1.12 backport/1.13 Changes are backported to 1.13 backport/1.14 Changes are backported to 1.14 labels Oct 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport/1.12 Changes are backported to 1.12 backport/1.13 Changes are backported to 1.13 backport/1.14 Changes are backported to 1.14
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants