-
Notifications
You must be signed in to change notification settings - Fork 4k
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 memory leak while fetching GCE instance templates. #7694
base: master
Are you sure you want to change the base?
Conversation
Hi @mtrqq. Thanks for your PR. I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
/assign towca |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ughh, these caches are such a pain to read through or extend :/
Thanks for the change! Have you tested that it fixes the leak in a real cluster?
gc.cacheMutex.Lock() | ||
defer gc.cacheMutex.Unlock() | ||
|
||
requiredKeys := make(map[GceRef]struct{}, len(migs)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
k8s.io/utils/set.Set[GceRef]
will read much nicer here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree, that would be nice, but GceRef doesn't comply with the requirements of set.Set, due to not being ordered.
83d5340
to
90f9447
Compare
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: mtrqq The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
I've tested initial change in the cluster and it was working as expected, while porting the code to Refresh method it's very likely that I'll need to retest it |
90f9447
to
b026ef7
Compare
What type of PR is this?
/kind bug
What this PR does / why we need it:
This PR prevents instance templates and instance template names cache from leaking. Currently those caches aren't cleaned at all which causes issues for clusters with MIGs churn. This change is are adding cleaning for those caches to
RegenerateMigInstancesCache
which is called each hour worst case and cleans up caches only for the MIGs which are untracked.Does this PR introduce a user-facing change?
Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.: