Skip to content

Commit

Permalink
add lock before read Jobs map volcano-sh#3478
Browse files Browse the repository at this point in the history
  • Loading branch information
Wang-Kai committed May 24, 2024
1 parent 70a483b commit acb43cb
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions pkg/scheduler/cache/event_handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,8 @@ func (sc *SchedulerCache) syncTask(oldTask *schedulingapi.TaskInfo) error {
newPod, err := sc.kubeClient.CoreV1().Pods(oldTask.Namespace).Get(context.TODO(), oldTask.Name, metav1.GetOptions{})
if err != nil {
if errors.IsNotFound(err) {
sc.Mutex.Lock()
defer sc.Mutex.Unlock()
err := sc.deleteTask(oldTask)
if err != nil {
klog.Errorf("Failed to delete Pod <%v/%v> and remove from cache: %s", oldTask.Namespace, oldTask.Name, err.Error())
Expand Down

0 comments on commit acb43cb

Please sign in to comment.