Skip to content

Commit a48dbef

Browse files
committed
Fix concurrent writes for UpdateContainerStats
Signed-off-by: Daniel Lenar <[email protected]>
1 parent dc03a4b commit a48dbef

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

pkg/cri/store/sandbox/sandbox.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,8 +129,8 @@ func (s *Store) List() []Sandbox {
129129
// stats present in 'newContainerStats'. Returns errdefs.ErrNotFound
130130
// if the sandbox does not exist in the store.
131131
func (s *Store) UpdateContainerStats(id string, newContainerStats *stats.ContainerStats) error {
132-
s.lock.RLock()
133-
defer s.lock.RUnlock()
132+
s.lock.Lock()
133+
defer s.lock.Unlock()
134134
id, err := s.idIndex.Get(id)
135135
if err != nil {
136136
if err == truncindex.ErrNotExist {

0 commit comments

Comments
 (0)