mirror of
https://github.com/kubernetes/kubernetes.git
synced 2026-05-14 18:09:28 -04:00
Prevent potential concurrent map access by taking a lock before reading the topology cache's hintsPopulatedByService map. * staging/src/k8s.io/endpointslice/topologycache/topologycache.go (setHintsLocked, hasPopulatedHintsLocked): New helper functions. These are the same as the existing SetHints and HasPopulatedHints methods except that these helpers assume that a lock is already held. (SetHints): Use setHintsLocked. (HasPopulatedHints): Take a lock and use hasPopulatedHintsLocked. (AddHints): Take a lock and use setHintsLocked and hasPopulatedHintsLocked. * staging/src/k8s.io/endpointslice/topologycache/topologycache_test.go (TestTopologyCacheRace): Add a goroutine that calls HasPopulatedHints. |
||
|---|---|---|
| .. | ||
| event.go | ||
| sliceinfo.go | ||
| sliceinfo_test.go | ||
| topologycache.go | ||
| topologycache_test.go | ||
| utils.go | ||
| utils_test.go | ||