diff --git a/cgroups/fs/apply_raw.go b/cgroups/fs/apply_raw.go index 2d5a1c0ea..e9c06e1e2 100644 --- a/cgroups/fs/apply_raw.go +++ b/cgroups/fs/apply_raw.go @@ -75,6 +75,7 @@ func GetStats(c *cgroups.Cgroup) (*cgroups.Stats, error) { if err == cgroups.ErrNotFound { continue } + return nil, err } diff --git a/cgroups/systemd/apply_systemd.go b/cgroups/systemd/apply_systemd.go index ea3a53349..5755a5f4b 100644 --- a/cgroups/systemd/apply_systemd.go +++ b/cgroups/systemd/apply_systemd.go @@ -422,6 +422,11 @@ func GetStats(c *cgroups.Cgroup) (*cgroups.Stats, error) { for sysname, sys := range subsystems { subsystemPath, err := getSubsystemPath(c, sysname) if err != nil { + // Don't fail if a cgroup hierarchy was not found, just skip this subsystem + if err == cgroups.ErrNotFound { + continue + } + return nil, err }