fixing the PodGroup members deadlock by holding partial GPU reservations #3523
All Vouch review confidence checks passed
Residual risk 0.20 = Change Risk (0.46) × (1 − Review Confidence (0.57)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.46 · 461 lines diff across 5 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.367
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #3523"
general
weight: 0.35
archlitchi
What type of PR is this?
/kind bug
What this PR does / why we need it:
HAMi reserves GPUs for a pod in Filter. The scheduler extender API has no Unreserve, so when kube-scheduler gives up a cycle (for example when a gang times out at Permit, or Coscheduling rejects the group), HAMi is never told. The pod's GPUs stay counted until the pod is filtered again or deleted. Two gangs that split a node can then block each other indefinitely (#3484).
This PR releases the reservation when kube-scheduler reports the failure in the pod's
PodScheduled=Falsecondition:PodScheduled=Falsearrives for an unbound pod. Resyncs, bound pods and pods in theallocatingbind phase are left alone. A failure from an older cycle is ignored if this replica's newer Filter is not visible yet.hami.io/vgpu-node,hami.io/vgpu-time, device annotations) are removed from the pod, so a restarted scheduler or a new leader does not count them again. The JSON patch tests the pod's resourceVersion, node and time, so it never clears an allocation a later Filter wrote. Only the leader patches, in the background, outsideallocLock.All changes are in
pkg/scheduler. There are no new flags and no chart changes.Which issue(s) this PR fixes:
Fixes #3484
Special notes for your reviewer:
This covers the first fix proposed in the issue, releasing stale reservations. It does not add group-aware reservation or change the node-lock behavior.
Local testing:
make verifyandmake testpass (all 45 packages, with-race).| Scenario | master | this PR |
|---|---|---|
| #3484: two gangs of 4 x 1 GPU, queued A1, B1, A2, B2, ... | neither gang bound after 150 s, 4 GPUs stuck | one gang bound 4/4 after 24 s |
| Gang rejected, then a HAMi restart, then a pod needing 4 GPUs | - | annotations cleared; pod bound 8 s after the restart |
| Regression: gang that fits, then a normal 4-GPU pod | - | gang bound 4/4; pod bound in 1 s; no errors in the logs |
Not tested: native gang scheduling with
spec.schedulingGroup(Kubernetes 1.36+). It reports failures through the samePodScheduledcondition, but I could not run it locally.AI disclosure: I used an LLM (Claude) to help with the code, the tests and this description. I reviewed and tested all changes myself.
Does this PR introduce a user-facing change?:
```release-note
Fixed GPU reservations of pods that failed a scheduling cycle (for example a PodGroup Permit timeout) staying counted, which could deadlock gangs.
<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
<!-- coderabbit-ai-generated:v1 -->
Summary by CodeRabbit
Bug Fixes
Reservations are released from unbound pods after failed scheduling attempts, and stale updates no longer restore them.
Reservations remain in place for bound or actively allocating pods.
Allocation cleanup preserves newer allocations when pod details have changed.
* Reservation records are cleared when pods are deleted or become bound.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->