Skip to content

Unnecessary pids directory created under cgroup v2 root #862

@liuycsd

Description

@liuycsd

I'm running kubernetes v1.22 with cri-o v1.22 on a cgroupv2-enabled node. When starting pods, cri-o still creates /sys/fs/cgroup/pids/kubepods.slice/xxxxxx, like what it may do for cgroupv1. Then kubelet reports lots of container /pids/kubepods.slice/xxxxxx not found errors in its logs.

It seems that cri-o uses github.com/containers/podman/v3/pkg/cgroups, which was moved to this repository as pkg/cgroups several days ago.

Comparing the code, in pkg/cgroups/cpus.go, it ignores the directory creation for cgroupv2:

func (c *cpuHandler) Create(ctr *CgroupControl) (bool, error) {
	if ctr.cgroup2 {
		return false, nil
	}
	return ctr.createCgroupDirectory(CPU)
}

But in pkg/cgroups/pids.go, it does not:

func (c *pidHandler) Create(ctr *CgroupControl) (bool, error) {
	return ctr.createCgroupDirectory(Pids)
}

Is it intended to create the pids directory or not?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions