Skip to content

Commit 2f30fae

Browse files
committed
scheduler: fix data race after binding failure
When binding has failed, `Done` gets called by `handleBindingCycleError`. Calling it again is at best redundant and worse, suffers from a data race: - the `assumedPodInfo` is placed in the backoff queue - an event causes the `Pod` pointer to get updated in it - reading `assumedPodInfo.Pod.UID` races with that write This race was found with`go test -race`.
1 parent 9919063 commit 2f30fae

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

pkg/scheduler/schedule_one.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ func (sched *Scheduler) scheduleOne(ctx context.Context) {
121121
status := sched.bindingCycle(bindingCycleCtx, state, fwk, scheduleResult, assumedPodInfo, start, podsToActivate)
122122
if !status.IsSuccess() {
123123
sched.handleBindingCycleError(bindingCycleCtx, state, fwk, assumedPodInfo, start, scheduleResult, status)
124+
return
124125
}
125126
// Usually, DonePod is called inside the scheduling queue,
126127
// but in this case, we need to call it here because this Pod won't go back to the scheduling queue.

0 commit comments

Comments
 (0)