fix: isolate rule status cache per rule-reconcile workers - #332
Conversation
✅ Deploy Preview for node-readiness-controller canceled.
|
|
Welcome @bhuvan-somisetty! |
|
Hi @bhuvan-somisetty. Thanks for your PR. I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with Tip We noticed you've done this a few times! Consider joining the org to skip this step and gain Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions 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. |
|
/cc @ajaysundark @Priyankasaggu11929 @vitorfloriano @Karthik-K-N @AvineshTripathi Hey folks! Whenever you get a chance, could you please take a look at this PR when convenient? It addresses the data race and metric memory leak under concurrent node reconciliations described in #331. Thanks a lot! |
|
#209 however lacks the unit-tests, so could obsolete the former to take this one. Could you evaluate the fixes and also address the lint failures and update? |
|
/uncc @Priyankasaggu11929 @vitorfloriano @Karthik-K-N @AvineshTripathi @dchen1107 @SergeyKanzhelev please reassign to me once you updated the PR. |
…onDuration metric Fix data races when running with --node-concurrent-reconciles > 1 by returning deep-copied rule objects from getApplicableRulesForNode. This isolates in-memory status evaluation mutations on rule pointers across concurrent worker goroutines. Additionally, add missing EvaluationDuration unregistration in reconcileDelete to prevent Prometheus metric memory leaks when rules are deleted. Signed-off-by: bhuvan-somisetty <somisettybhuvan5@gmail.com>
ee57367 to
d58c938
Compare
|
Thanks for the review, @ajaysundark! I rebased onto latest Also fixed the lint failure: the test file had a gofmt formatting issue (extra blank line) and a Reassigning to you as requested. Let me know if you'd like anything else adjusted. |
|
/assign @ajaysundark |
|
/ok-to-test |
|
@bhuvan-somisetty Can you review #209 and evaluate the recordFailure patch you noted on your issue as well - this could be a separate followup PR. |
|
/retitle fix: isolate rule status cache per rule-reconcile workers |
|
/lgtm |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: ajaysundark, bhuvan-somisetty 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 |
|
Thanks @ajaysundark! Took a look at #209 and dug into the
Opened #333 as the separate follow-up you suggested, scoped to just that fix (added a |
Description
This PR resolves data races and memory leaks in the controller when
--node-concurrent-reconcilesis set to > 1:RuleReadinessController.getApplicableRulesForNodeto returnrule.DeepCopy()pointers. Previously, returning pointers straight fromr.ruleCachecaused concurrentNodeReconcilerworker threads to mutaterule.Status.NodeEvaluationsandrule.Status.FailedNodeson the shared in-memory pointer without synchronization, resulting in Go data races and memory corruption under concurrent node reconciliation load.2. Prometheus Metric Leak Fix: Addedmetrics.EvaluationDuration.DeleteLabelValues(rule.Name)toreconcileDeleteinnodereadinessrule_controller.goto ensure histogram metric series are unregistered when a rule CR is deleted.TestGetApplicableRulesForNode_DeepCopyinhelper_unit_test.goto verify thatgetApplicableRulesForNodereturns isolated, deep-copied rule instances.Related Issue
Fixes #331
Type of Change
/kind bug
Testing
go test -v ./internal/controller/...Checklist
make testpassesmake lintpassesDoes this PR introduce a user-facing change?