Skip to content

stats API endpoint crashing 500 when container has no cgroup #24632

Closed
@mrgleeco

Description

@mrgleeco

Issue Description

hello! I found a surprising behavior via use of the podman-exporter to report metrics.

In creating a pod via kube play, the pod is created fine, but the metrics endpoint is failing with 500:

curl -s localhost:5000/v5.2.5/libpod/containers/stats
Request Failed(Internal Server Error): cannot run top on container 0c72.. as it did not create a cgroup: this container does not have a cgroup

error logged:

GET /v5.2.5/libpod/containers/stats?all=false&interval=1&stream=false HTTP/1.1" 500 239 "" "Go-http-client/1.1"

Here the container 0c72.. is a pause container. I would not expect the endpoint to crash 500 and deny all stat info.

Notably podman is rootless mode and in k8s (ie like DnD). Not seeing the problem in native host mode.

Unclear if containers.conf is the source of problem. Have not had time to extensively rtfm there, but a latest attempt looked like this (largely inherited from /etc version found at https://quay.io/repository/containers/podman)

[containers]
netns="host"
userns="host"
ipcns="host"
utsns="host"
cgroupns="host"
cgroups="disabled"
log_driver = "k8s-file"
volumes = [
        "/proc:/proc",
]
default_sysctls = []

[engine]
cgroup_manager = "cgroupfs"
events_logger="file"
runtime="crun"

Version info

$ podman version
Client:       Podman Engine
Version:      5.2.5
API Version:  5.2.5
Go Version:   go1.23.2
Built:        Fri Oct 18 00:00:00 2024
OS/Arch:      linux/amd64

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/bugCategorizes issue or PR as related to a bug.locked - please file new issue/PRAssist humans wanting to comment on an old issue or PR with locked comments.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions