Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
mrgleeco opened this issue Nov 21, 2024 · 1 comment · Fixed by #24701
Closed

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

mrgleeco opened this issue Nov 21, 2024 · 1 comment · Fixed by #24701
Labels
kind/bug Categorizes issue or PR as related to a bug.

Comments

@mrgleeco
Copy link

mrgleeco commented Nov 21, 2024

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
@mrgleeco mrgleeco added the kind/bug Categorizes issue or PR as related to a bug. label Nov 21, 2024
giuseppe added a commit to giuseppe/libpod that referenced this issue Nov 28, 2024
Now `podman stats --all` ignores failures from a container that has no
cgroups.

Closes: containers#24632

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
@giuseppe
Copy link
Member

giuseppe commented Nov 28, 2024

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants