Thanks to visit codestin.com
Credit goes to github.com

Skip to content

cgroupfs: container created with bad cgroup path #4075

@kolyshkin

Description

@kolyshkin

Description

cri-o messes up cgroup paths for cgroupv2 + cgroupfs setup. Update: The bug is valid for both cgroupv1 and v2.

Steps to reproduce the issue:

~~On a cgroupv2 host (e.g. Fedora 32), ~~ in cri-o top source directory, run the following:

export CONTAINER_CGROUP_MANAGER=cgroupfs
export CONTAINER_CONMON_CGROUP=pod

# fix json files so they don't contain `.slice`
./scripts/circle-setup-cgroup_manager 

# create a simple test
cd test
cat << EOF > 1.bats
load helpers

function setup() {
    setup_test
}

function teardown() {
    cleanup_test
}

@test "eh" {
    start_crio
    id=$(crictl run "$TESTDATA"/container_redis.json "$TESTDATA"/sandbox_config.json)

    crictl inspect "$id" | grep cgroupsPath 1>&2
    find /sys/fs/cgroup -name \*$id\* -type d 1>&2
    stats=$(crictl stats -o json $id)
}
EOF

# run it (as root)
JOBS=1 ./test_runner.sh 1.bats

Describe the results you received:

Excerpts from the output of the above test case.

  1. Result of crictl inspect "$id" | grep cgroupsPath:
     "cgroupsPath": "pod_123-456/crio-b9e3a62d9ae9edc3f97e9167bdfdb6dd73960422cf343cc6188501b05d3f88c5",
  1. Result of find /sys/fs/cgroup -name \*$id\* -type d:

/sys/fs/cgroup/pids/pod_123-456/crio-conmon-b9e3a62d9ae9edc3f97e9167bdfdb6dd73960422cf343cc6188501b05d3f88c5
/sys/fs/cgroup/pod_123-456/crio-conmon-b9e3a62d9ae9edc3f97e9167bdfdb6dd73960422cf343cc6188501b05d3f88c5
/sys/fs/cgroup/pod_123-456/crio-conmon-b9e3a62d9ae9edc3f97e9167bdfdb6dd73960422cf343cc6188501b05d3f88c5/pod_123-456/crio-b9e3a62d9ae9edc3f97e9167bdfdb6dd73960422cf343cc6188501b05d3f88c5

  1. A warning from cricrl stats:

time="2020-08-12 12:39:02.476864773-07:00" level=warning msg="Unable to get stats for container bfd5732672995e847102e4970f6ceddb23d9d48e1d81ee50a785f92cbe900d70: unable to obtain cgroup stats: open /sys/fs/cgroup/pod_123-456/crio-bfd5732672995e847102e4970f6ceddb23d9d48e1d81ee50a785f92cbe900d70/memory.current: open /sys/fs/cgroup/pod_123-456/crio-bfd5732672995e847102e4970f6ceddb23d9d48e1d81ee50a785f92cbe900d70/memory.current: no such file or directory" file="server/container_stats_list.go:40" id=d469ad95-1243-4b7c-b506-6d423e898573 name=/runtime.v1alpha2.RuntimeService/ListContainerStats

Describe the results you expected:

Output from find (item 2 above) should show the same path as inspect's cgroupPath (item 1 above).

Additional information you deem important (e.g. issue happens only occasionally):

Output of crio --version:

[root@kir-rhat test]# ../bin/crio --version
crio version 1.19.0-dev
Version:       1.19.0-dev
GitCommit:     e2151c78e148001f7e1a8558b11d17c276c2032d
GitTreeState:  dirty
BuildDate:     2020-08-12T18:16:55Z
GoVersion:     go1.14.6
Compiler:      gc
Platform:      linux/amd64
Linkmode:      dynamic

Additional environment details (AWS, VirtualBox, physical, etc.):

Fedora 32

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