fix(scheduler): skip a topology candidate card missing from the node - #6
Closed
Wangmin362 wants to merge 1 commit into
Closed
fix(scheduler): skip a topology candidate card missing from the node#6Wangmin362 wants to merge 1 commit into
Wangmin362 wants to merge 1 commit into
Conversation
computeWorstSingleCard and computeBestCombination look up deviceScoreMap by the UUID of candidate cards taken from an earlier snapshot. If a card was dropped from the node between the snapshot and scoring, the lookup returns nil and the next .Scores access panics. Skip such cards instead of dereferencing nil. Signed-off-by: wangmin <wangmin@riseunion.io>
Owner
Author
|
Withdrawn. On current master this nil-deref is no longer reachable: Project-HAMi#2046 changed calcScore from the live GetNode pointer to the frozen node.NodeInfo snapshot, so the topology candidate set and the score map now come from the same copy and cannot diverge. It was reachable before Project-HAMi#2046 (live pointer). Not worth a defensive-only patch. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What type of PR is this?
/kind bug
What this PR does / why we need it:
computeWorstSingleCardandcomputeBestCombinationbuilddeviceScoreMapfrom the live node, but the candidate cards they iterate come from an earlier snapshot. If a card was dropped from the node in between,deviceScoreMap[uuid]is nil and the next.Scores[...]access panics, taking down the scheduler. This adds a nil check so the missing card is skipped instead.Which issue(s) this PR fixes:
NONE
Special notes for your reviewer:
Added two unit tests where a candidate UUID is not present on the node. Without the fix they panic with a nil pointer dereference (device.go:946 and :969); with it they pass.
go test ./pkg/device/nvidia/,go vetandgofmtare clean.Does this PR introduce a user-facing change?
The scheduler no longer panics during topology scoring when a candidate card has been removed from the node.
AI Assistant disclosure:
This PR was written with the help of Claude Code. I reviewed and understand the change.