From 7864afd6b2c0cfaa91a7cd1d255ece4c89814ce2 Mon Sep 17 00:00:00 2001 From: Sascha Grunert Date: Mon, 6 Apr 2020 13:04:52 +0200 Subject: Do not error on pids.current stats if ctr.path is empty If the ctr.path is empty, then we do not try to access `/sys/fs/cgroup/pids/pids.current` any more because this path will be wrong in any case. We now return and do not set the PIDs stats. Refers to https://github.com/cri-o/cri-o/issues/3522 Signed-off-by: Sascha Grunert --- pkg/cgroups/pids.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'pkg/cgroups') diff --git a/pkg/cgroups/pids.go b/pkg/cgroups/pids.go index 65b9b5b34..92f82553b 100644 --- a/pkg/cgroups/pids.go +++ b/pkg/cgroups/pids.go @@ -44,8 +44,12 @@ func (c *pidHandler) Destroy(ctr *CgroupControl) error { // Stat fills a metrics structure with usage stats for the controller func (c *pidHandler) Stat(ctr *CgroupControl, m *Metrics) error { - var PIDRoot string + if ctr.path != "" { + // nothing we can do to retrieve the pids.current path + return nil + } + var PIDRoot string if ctr.cgroup2 { PIDRoot = filepath.Join(cgroupRoot, ctr.path) } else { -- cgit v1.2.3-54-g00ecf