Fix memory leaks in expired matchers#3358
Conversation
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: dsimansk The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3358 +/- ##
=======================================
Coverage 74.85% 74.85%
=======================================
Files 189 189
Lines 8347 8347
=======================================
Hits 6248 6248
Misses 1854 1854
Partials 245 245 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
linkvt
left a comment
There was a problem hiding this comment.
/lgtm
/hold in case Dave should also take a look, feel free to unhold
|
I don't generally like the tests accessing the internals - but I see the style is just complementing what's already there so I don't want to gate the PR on that /hold cancel |
|
/cherry-pick release-1.22 |
|
@dsimansk: new pull request created: #3359 DetailsIn response to this:
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. |
|
@dsimansk: new pull request created: #3360 DetailsIn response to this:
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. |
Changes
Memory leaks observed in @maschmid long running soak tests:
After pruning expired inexact matchers, the code checked
len(s)(the exact matchers map) instead oflen(ms)(the inexact matchers map), and then deleted from i.exact instead ofi.inexact. This meant empty inexact matcher entries were never cleaned up, causing a memory leak for every label-selector-based tracker reference.When removing inexact matchers for a deleted object, the code called delete(i.exact, ref) instead of
delete(i.inexact, ref), so empty inexact entries accumulated indefinitely and could also incorrectly remove unrelated exact entries.Release Note
PTAL, it's a follow-up to other memory leak in networking hanging idle connections.
/cc @dprotaso