fix: remove UnsafeDisableDeepCopy in groupAllSandboxes to prevent informer cache corruption#387
Conversation
…ormer cache corruption groupAllSandboxes lists sandboxes with client.UnsafeDisableDeepCopy, returning raw informer cache pointers. Downstream code (scaleDownSandbox, deleteSandboxForUpdate) mutates annotations on these pointers via LockSandbox, silently corrupting the informer cache and causing non-deterministic controller behavior under concurrent load. Additionally, scaleDown uses append(groups.Creating, groups.Available...) which is a Go slice aliasing trap — when Creating has spare backing-array capacity, Available elements silently overwrite Creating's memory. Fix: 1. Remove client.UnsafeDisableDeepCopy from the List call so objects are deep-copied and safe for downstream mutation. 2. Replace the aliasing append with explicit make + two appends. Fixes openkruise#386
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
Welcome @oindrilakha12-ui! It looks like this is your first PR to openkruise/agents 🎉 |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #387 +/- ##
=======================================
Coverage 75.90% 75.91%
=======================================
Files 145 145
Lines 10626 10627 +1
=======================================
+ Hits 8066 8067 +1
Misses 2212 2212
Partials 348 348
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
What
Remove client.UnsafeDisableDeepCopy from groupAllSandboxes and fix slice aliasing in scaleDown to prevent informer cache corruption during concurrent scale-down and rolling update operations.
Why
Changes
Fixes #386
Fixes #388