diff --git a/internal/proxy/privilege_cache.go b/internal/proxy/privilege_cache.go index f319b705dc27f..611dd0fb5b4e9 100644 --- a/internal/proxy/privilege_cache.go +++ b/internal/proxy/privilege_cache.go @@ -41,12 +41,14 @@ func getPriCache() *PrivilegeCache { priCacheInitOnce.Do(func() { priCacheMut.Lock() defer priCacheMut.Unlock() - c = &PrivilegeCache{ + priCache = &PrivilegeCache{ version: ver.Inc(), values: typeutil.ConcurrentMap[string, bool]{}, } - priCache = c }) + priCacheMut.RLock() + defer priCacheMut.RUnlock() + c = priCache } return c