mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-07-18 04:54:54 +00:00
Reading numPreFilterCalled races with writing it in the scheduler, at least as far as the data race detector is concerned. That the test waits for pod scheduling is too indirect. enqueuePlugin.called has the same problem, but hasn't triggered the race detector (yet). We need to protect against concurrent access. The easiest way to enforce that is via atomic.Int64. In contrast to a mutex it is impossible to use it wrong. Shutting down the scheduler first was also tried, but didn't work out because "teardown" does more than just stopping the scheduler, it also cancels a context that is needed during test shutdown.