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/10/07 19:30:00 UTC

[jira] [Created] (YUNIKORN-3500) [Core] Fix queue path prefix collision in QueuePreemptionSnapshot.GetRemainingGuaranteedResource

Hedger Lai created YUNIKORN-3500:
------------------------------------

             Summary: [Core] Fix queue path prefix collision in QueuePreemptionSnapshot.GetRemainingGuaranteedResource
                 Key: YUNIKORN-3500
                 URL: https://issues.apache.org/jira/browse/YUNIKORN-3500
             Project: Apache YuniKorn
          Issue Type: Sub-task
          Components: core - scheduler
            Reporter: Hedger Lai
            Assignee: Hedger Lai


h3. Problem

In {{QueuePreemptionSnapshot.GetRemainingGuaranteedResource()}} ({{pkg/scheduler/objects/preemption.go}}), the shared-ancestor check uses {{strings.HasPrefix}} without a hierarchy delimiter:

{code:go}
if !remainingGuaranteed.IsEmpty() && strings.HasPrefix(qps.AskQueue.QueuePath, qps.QueuePath) && !askQueueRemainingGuaranteed.IsEmpty() {
    return nil
}
{code}

Because {{qps.QueuePath}} does not include a trailing dot ({{.}}), a queue path such as {{"root.parent"}} falsely matches an unrelated ask queue whose path starts with the same prefix, such as {{"root.parent1.child3"}} ({{strings.HasPrefix("root.parent1.child3", "root.parent") == true}}).

As a result, when {{"root.parent1.child3"}} (with remaining guaranteed quota) attempts to preempt a victim under {{"root.parent.child1"}}, {{"root.parent"}} is mistakenly treated as a shared ancestor of {{"root.parent1.child3"}} and returns {{nil}}, bypassing {{"root.parent"}}'s guaranteed resource protection.

h3. Solution

Replace {{strings.HasPrefix(qps.AskQueue.QueuePath, qps.QueuePath)}} with tree-based ancestor check (e.g. {{qps.isAncestorOf(qps.AskQueue)}} introduced in YUNIKORN-3499) so that only actual ancestors in the queue hierarchy are exempted, and add unit test coverage for sibling parent queues with shared name prefixes (e.g. {{"root.parent"}} vs. {{"root.parent1"}}).



--
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