You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@yunikorn.apache.org by "Hedger Lai (Jira)" <ji...@apache.org> on 2026/09/19 04:43:00 UTC

[jira] [Created] (YUNIKORN-3463) [Core] Premature loop abort and missing satisfaction early-stop in calculateAdditionalVictims

Hedger Lai created YUNIKORN-3463:
------------------------------------

             Summary: [Core] Premature loop abort and missing satisfaction early-stop in calculateAdditionalVictims
                 Key: YUNIKORN-3463
                 URL: https://issues.apache.org/jira/browse/YUNIKORN-3463
             Project: Apache YuniKorn
          Issue Type: Bug
          Components: core - scheduler
            Reporter: Hedger Lai
            Assignee: Hedger Lai
             Fix For: 1.6.0


h3. Symptom
In {{Preemptor.calculateAdditionalVictims()}}, preemption for queue quota exhibits two loop control defects:
1. If an early candidate victim cannot fit in the ask queue's remaining guaranteed headroom, the loop executes a raw {{break}}, prematurely aborting the search and starving subsequent viable victims.
2. Conversely, when accumulated victims have already satisfied the ask queue's guaranteed quota, the loop fails to exit early, scanning remaining victims unnecessarily.

h3. Root Cause
In {{pkg/scheduler/objects/preemption.go}}:
{code:go}
askQueueRemaining := askQueue.GetRemainingGuaranteedResource()
if askQueueRemaining != nil && askQueueRemaining.FitInActual(victim.GetAllocatedResource()) {
    askQueue.AddAllocation(victim.GetAllocatedResource())
} else {
    queueSnapshot.AddAllocation(victim.GetAllocatedResource())
    break // <-- Flaw 1: premature abort on fit failure
}
// ...
// Flaw 2: missing early-stop when quota is already satisfied
{code}

h3. Proposed Fix
1. In the {{else}} branch of {{FitInActual()}}, replace {{break}} with {{continue}} to evaluate subsequent viable candidates.
2. After appending a valid victim, {{break}} immediately if {{isAskQueueUnderGuaranteed()}} is satisfied.





--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@yunikorn.apache.org
For additional commands, e-mail: dev-help@yunikorn.apache.org