This is an automated email from the ASF dual-hosted git repository.

ccondit pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/yunikorn-k8shim.git


The following commit(s) were added to refs/heads/master by this push:
     new 04e9340a [YUNIKORN-2068] Fix deadlock when evaluating preemption 
candidates (#697)
04e9340a is described below

commit 04e9340ab42b58ff25862599a2935b8128363bbe
Author: Craig Condit <[email protected]>
AuthorDate: Mon Oct 23 18:36:03 2023 -0500

    [YUNIKORN-2068] Fix deadlock when evaluating preemption candidates (#697)
    
    Closes: #697
---
 pkg/cache/context.go                  | 2 +-
 pkg/cache/external/scheduler_cache.go | 4 ++++
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/pkg/cache/context.go b/pkg/cache/context.go
index d3488bc1..a255e78d 100644
--- a/pkg/cache/context.go
+++ b/pkg/cache/context.go
@@ -474,7 +474,7 @@ func (ctx *Context) IsPodFitNodeViaPreemption(name, node 
string, allocations []s
                        // look up each victim in the scheduler cache
                        victims := make([]*v1.Pod, 0)
                        for _, uid := range allocations {
-                               if victim, ok := 
ctx.schedulerCache.GetPod(uid); ok {
+                               if victim, ok := 
ctx.schedulerCache.GetPodNoLock(uid); ok {
                                        victims = append(victims, victim)
                                } else {
                                        // if pod isn't found, add a 
placeholder so that the list is still the same size
diff --git a/pkg/cache/external/scheduler_cache.go 
b/pkg/cache/external/scheduler_cache.go
index 3a4434e7..aaf063f5 100644
--- a/pkg/cache/external/scheduler_cache.go
+++ b/pkg/cache/external/scheduler_cache.go
@@ -471,6 +471,10 @@ func (cache *SchedulerCache) removePod(pod *v1.Pod) {
 func (cache *SchedulerCache) GetPod(uid string) (*v1.Pod, bool) {
        cache.lock.RLock()
        defer cache.lock.RUnlock()
+       return cache.GetPodNoLock(uid)
+}
+
+func (cache *SchedulerCache) GetPodNoLock(uid string) (*v1.Pod, bool) {
        if pod, ok := cache.podsMap[uid]; ok {
                return pod, true
        }


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to