Merge pull request #6236 from crosbymichael/cri-panic

use write lock when updating container stats
This commit is contained in:
Derek McGowan 2021-11-11 09:34:09 -08:00 committed by GitHub
commit 7ad570964b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -170,8 +170,8 @@ func (s *Store) List() []Container {
}
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 {