Skip to content

Commit 9f65014

Browse files
danlenarthaJeztah
authored andcommitted
Fix concurrent writes for UpdateContainerStats
Signed-off-by: Daniel Lenar <[email protected]> (cherry picked from commit a48dbef) Signed-off-by: Sebastiaan van Stijn <[email protected]>
1 parent 3787ef4 commit 9f65014

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
@@ -125,8 +125,8 @@ func (s *Store) List() []Sandbox {
125125
}
126126

127127
func (s *Store) UpdateContainerStats(id string, newContainerStats *stats.ContainerStats) error {
128-
s.lock.RLock()
129-
defer s.lock.RUnlock()
128+
s.lock.Lock()
129+
defer s.lock.Unlock()
130130
id, err := s.idIndex.Get(id)
131131
if err != nil {
132132
if err == truncindex.ErrNotExist {

0 commit comments

Comments
 (0)