fix: return snapshot in InspectAllNodesUsage to avoid data race - #1967
Conversation
Signed-off-by: james <open4pd@4paradigm.com>
InspectAllNodesUsage to avoid data raceInspectAllNodesUsage to avoid data race
There was a problem hiding this comment.
Code Review
This pull request improves concurrency safety by switching to read locks in GetPod and creating a deep-copied snapshot under a read lock in InspectAllNodesUsage. However, a critical data race remains because s.overviewstatus is updated concurrently in getNodesUsage without holding the lock. It is recommended to refactor getNodesUsage to return the maps so that callers can safely assign them under the lock.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
Codecov Report❌ Patch coverage is
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
Signed-off-by: james <open4pd@4paradigm.com>
|
second commit (Jun 24) fixes the race: |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: archlitchi, DSFans2014 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 |
What type of PR is this?
/kind bug
What this PR does / why we need it:
InspectAllNodesUsage. Since the underlying data may be concurrently modified, this could lead to a data race.cachedstatusfrom schedulerWhich issue(s) this PR fixes:
Fixes #
Special notes for your reviewer:
Does this PR introduce a user-facing change?: