scheduler-perf: fix data race in createPodsSteadily

A mutex lock around decrementing runningPods was missing, leading to a data
race report in ci-kubernetes-integration-race-master:

WARNING: DATA RACE
Read at 0x00c001bd20a8 by goroutine 95696:
  k8s.io/kubernetes/test/integration/scheduler_perf.createPodsSteadily.func7()
      /home/prow/go/src/k8s.io/kubernetes/test/integration/scheduler_perf/scheduler_perf.go:2133 +0x238
  ...

Previous write at 0x00c001bd20a8 by goroutine 101407:
  k8s.io/kubernetes/test/integration/scheduler_perf.createPodsSteadily.func5()
      /home/prow/go/src/k8s.io/kubernetes/test/integration/scheduler_perf/scheduler_perf.go:2064 +0x1a4
  ...
This commit is contained in:
Patrick Ohly
2025-09-03 09:37:36 +02:00
parent d9df4ecff7
commit 07faaec2c4

View File

@@ -2059,6 +2059,8 @@ func createPodsSteadily(tCtx ktesting.TContext, namespace string, podInformer co
return
}
mutex.Lock()
defer mutex.Unlock()
existingPods--
if pod.Spec.NodeName != "" {
runningPods--