Skip to content

Commit

Permalink
Merge pull request #3479 from Wang-Kai/fix-scheduler-synctask-panic
Browse files Browse the repository at this point in the history
add lock before read Jobs map #3478
  • Loading branch information
volcano-sh-bot authored May 31, 2024
2 parents b0d7bb5 + 6ffc12d commit fd40753
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 fd40753

Please sign in to comment.