-
Notifications
You must be signed in to change notification settings - Fork 38.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix a race in the scheduler. #70892
Fix a race in the scheduler. #70892
Conversation
/retest |
/assign |
/retest |
Loop over priorityConfigs seperately. The node loop can only safely modify result[i][index]. Before this change it sometimes modified result[i] concurrently with other loops. Fixes: 7164967 ==================== Test output for //pkg/scheduler/core:go_default_test: ================== WARNING: DATA RACE Read at 0x00c0005e8ed0 by goroutine 22: k8s.io/kubernetes/pkg/scheduler/core.PrioritizeNodes.func2() pkg/scheduler/core/generic_scheduler.go:667 +0x2ea k8s.io/kubernetes/vendor/k8s.io/client-go/util/workqueue.ParallelizeUntil.func1() staging/src/k8s.io/client-go/util/workqueue/parallelizer.go:65 +0x9e Previous write at 0x00c0005e8ed0 by goroutine 21: k8s.io/kubernetes/pkg/scheduler/core.PrioritizeNodes.func2() pkg/scheduler/core/generic_scheduler.go:668 +0x450 k8s.io/kubernetes/vendor/k8s.io/client-go/util/workqueue.ParallelizeUntil.func1() staging/src/k8s.io/client-go/util/workqueue/parallelizer.go:65 +0x9e Goroutine 22 (running) created at: k8s.io/kubernetes/vendor/k8s.io/client-go/util/workqueue.ParallelizeUntil() staging/src/k8s.io/client-go/util/workqueue/parallelizer.go:57 +0x1a3 k8s.io/kubernetes/pkg/scheduler/core.PrioritizeNodes() pkg/scheduler/core/generic_scheduler.go:682 +0x592 k8s.io/kubernetes/pkg/scheduler/core.(*genericScheduler).Schedule() pkg/scheduler/core/generic_scheduler.go:186 +0x77d k8s.io/kubernetes/pkg/scheduler/core.TestGenericScheduler.func1() pkg/scheduler/core/generic_scheduler_test.go:464 +0x91f testing.tRunner() GOROOT/src/testing/testing.go:827 +0x162 Goroutine 21 (running) created at: k8s.io/kubernetes/vendor/k8s.io/client-go/util/workqueue.ParallelizeUntil() staging/src/k8s.io/client-go/util/workqueue/parallelizer.go:57 +0x1a3 k8s.io/kubernetes/pkg/scheduler/core.PrioritizeNodes() pkg/scheduler/core/generic_scheduler.go:682 +0x592 k8s.io/kubernetes/pkg/scheduler/core.(*genericScheduler).Schedule() pkg/scheduler/core/generic_scheduler.go:186 +0x77d k8s.io/kubernetes/pkg/scheduler/core.TestGenericScheduler.func1() pkg/scheduler/core/generic_scheduler_test.go:464 +0x91f testing.tRunner() GOROOT/src/testing/testing.go:827 +0x162 ================== --- FAIL: TestGenericScheduler (0.01s) --- FAIL: TestGenericScheduler/test_6 (0.00s) testing.go:771: race detected during execution of test testing.go:771: race detected during execution of test FAIL
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
Thanks @mikedanese for addressing this!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
/approve
Thanks, @mikedanese!
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: bsalamat, mikedanese The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Loop over priorityConfigs seperately. The node loop can only safely
modify result[i][index]. Before this change it sometimes modified
result[i] concurrently with other loops.
Verified with
go test -race -run=TestGenericScheduler/test_6 -test.v -count 1000 ./pkg/scheduler/core
/kind bug
/sig scheduling