fix: handle requeued gang members in eviction and assertion logic#4733
Merged
dejanzele merged 2 commits intoarmadaproject:masterfrom Mar 3, 2026
Merged
Conversation
d325b90 to
2dc3edc
Compare
1379282 to
9011ce0
Compare
Signed-off-by: Dejan Zele Pejchev <pejcev.dejan@gmail.com>
9011ce0 to
b119708
Compare
JamesMurkin
reviewed
Mar 2, 2026
JamesMurkin
approved these changes
Mar 3, 2026
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?
Bug fix
What this PR does / why we need it
Fixes a gang eviction assertion crash (
gang was partially evicted: 2 out of 3 jobs evicted) that occurs when a gang has a member that was returned by the executor and requeued.Root cause: When the executor returns a failed gang job, the scheduler requeues it with
WithQueued(true), butLatestRun().NodeId()still points to the old node. When oversubscribed eviction later targets a running gang member,collectIdsForGangEvictionreads the stale node ID from the requeued job, the filtered evictor looks at the wrong node, gang eviction is incomplete, andevictionAssertionspanics because it expects all gang members to be evicted but the requeued member was never on the node the evictor checked.Changes in
preempting_queue_scheduler.go:collectIdsForGangEviction: Check the scheduling context first for a node ID (handles current-round rescheduling). If the job is not in the scheduling context and is queued, skip node collection entirely (the job is not on any node). Fall back toLatestRun().NodeId()only for running jobs.evictionAssertions: Exclude queued-and-not-evicted gang members from the expected eviction count. These members are not on any node and cannot be evicted, so they should not contribute to the total the assertion checks against.Which issue(s) this PR fixes
Special notes for your reviewer
The crash is deterministic when a gang has a mix of running and requeued members and oversubscribed eviction is triggered.
Before this fix, the node-lookup order was:
LatestRun() == nil-> scheduling context, else ->LatestRun().NodeId(). This missed the case whereLatestRun()is non-nil but stale (requeued job).The new order is: scheduling context first -> queued with no context (skip node) ->
LatestRun().NodeId()for running jobs -> error for anything else.