diff --git a/pkg/cri/store/sandbox/sandbox.go b/pkg/cri/store/sandbox/sandbox.go index 35e4603a2..26dd8f6db 100644 --- a/pkg/cri/store/sandbox/sandbox.go +++ b/pkg/cri/store/sandbox/sandbox.go @@ -129,8 +129,8 @@ func (s *Store) List() []Sandbox { // stats present in 'newContainerStats'. Returns errdefs.ErrNotFound // if the sandbox does not exist in the store. func (s *Store) UpdateContainerStats(id string, newContainerStats *stats.ContainerStats) error { - s.lock.RLock() - defer s.lock.RUnlock() + s.lock.Lock() + defer s.lock.Unlock() id, err := s.idIndex.Get(id) if err != nil { if err == truncindex.ErrNotExist {