diff --git a/pkg/proxy/userspace/roundrobin.go b/pkg/proxy/userspace/roundrobin.go index 6bbc558eae8..17ba9e21649 100644 --- a/pkg/proxy/userspace/roundrobin.go +++ b/pkg/proxy/userspace/roundrobin.go @@ -122,8 +122,8 @@ func isSessionAffinity(affinity *affinityPolicy) bool { // ServiceHasEndpoints checks whether a service entry has endpoints. func (lb *LoadBalancerRR) ServiceHasEndpoints(svcPort proxy.ServicePortName) bool { - lb.lock.Lock() - defer lb.lock.Unlock() + lb.lock.RLock() + defer lb.lock.RUnlock() state, exists := lb.services[svcPort] // TODO: while nothing ever assigns nil to the map, *some* of the code using the map // checks for it. The code should all follow the same convention.