From 689b342c1d6a5388f149721a5afb55d03837b41d Mon Sep 17 00:00:00 2001 From: Henry Wang Date: Thu, 21 Apr 2022 21:34:04 +0000 Subject: [PATCH] cri: close fifos when container is deleted Signed-off-by: Henry Wang (cherry picked from commit 8710d4d014ef1b17c6f15bac4532f89429fc05a2) Signed-off-by: Wei Fu --- pkg/cri/store/container/container.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pkg/cri/store/container/container.go b/pkg/cri/store/container/container.go index c74965b7af6f..82cba188cd5f 100644 --- a/pkg/cri/store/container/container.go +++ b/pkg/cri/store/container/container.go @@ -175,7 +175,11 @@ func (s *Store) Delete(id string) { // So we need to return if there are error. return } - s.labels.Release(s.containers[id].ProcessLabel) + c := s.containers[id] + if c.IO != nil { + c.IO.Close() + } + s.labels.Release(c.ProcessLabel) s.idIndex.Delete(id) // nolint: errcheck delete(s.containers, id) }