bug: CPU usage misses other processes that share the same CPU limit (cgroup v2)
@DanielleMaywood ya está trabajando en esto.
Desde el 23/10/2026.
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 67/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Stack tecnológico
- go, linux
- Área
- observability
Línea de trabajo
Read the CPU limit and usage handling behind ContainerCPU(), then compare it with the memory cgroup selection described in #39. Update CPU usage selection to use the cgroup with the applicable limit, and check that usage remains unchanged when the process cgroup has the limit or no limit exists. The expected reproduction is about 4.3/12 cores (36%) in the reported nested cgroup setup.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Summary
This is the CPU version of #38.
clistat gets the CPU limit from the nearest parent cgroup that has one. But it reads CPU usage from the process's own cgroup. Other cgroups under that parent use the same limit, but their usage is not counted. So clistat can show the container as almost idle when it is busy.
This often happens when a container runs other containers inside it. The process is in /init.scope and the inner containers are in /docker/<id>. Both are under the container root, which has the limit.
Why this is wrong
- A cgroup's
cpu.statincludes CPU time from all cgroups below it. In the kernel, each cgroup's CPU time is added to its parent's (cgroup_base_stat_flush()inkernel/cgroup/rstat.c, v6.17). If you only want a cgroup's own time, there is a separate file,cpu.stat.local. - A limit in
cpu.maxapplies to the cgroup and everything below it (cgroup v2 docs).
So to see how close we are to the limit, we must read usage from the cgroup that has the limit.
How to reproduce
We used a sysbox container on cgroup v2. The container root has a 12-core limit (cpu.max is 1200000 100000). /init.scope has no limit, and the process is in /init.scope. Then we ran 4 busy loops in an inner container:
docker run -d --name cpuhog alpine sh -c 'for i in 1 2 3 4; do (while :; do :; done) & done; wait'
| What we measured (over 2 seconds) | Cores used |
|---|---|
| Container root | 4.3 |
/docker |
4.01 |
/init.scope |
0.01 |
ContainerCPU() on main (a2db32a) |
0.009/12 cores (0%) |
What should happen
clistat should show about 4.3/12 cores (36%).
How to fix it
Do the same thing #39 does for memory. Find the cgroup that has the CPU limit, then read CPU usage from that same cgroup. If the process's own cgroup has the limit, or there is no limit, nothing changes.
The nearest limit is not always the one that matters. That is a separate problem, covered in #40.
Generated by Coder Agents on behalf of @DanielleMaywood.
- Lenguaje dominante
- Go
- Estrellas
- 11
- Forks
- 2
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Preparar el entorno
Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de coder/clistat
-
bug: clistat only checks the nearest limit, but every parent's limit applies (cgroup v2)Posiblemente ocupada @david-fraley la tomó hace 1 día. Abierto
Dificultad 4/5 3-5 días Aptitud para principiantes 48/100
-
Dificultad 3/5 1-2 días Aptitud para principiantes 72/100
-
Bug
Dificultad 4/5 3-5 días Aptitud para principiantes 48/100
-
feat: add directory-level disk usage statsQuizá libre de nuevo Un pull request para esta issue se cerró sin fusionarse. Abiertoenhancement
Dificultad 5/5 Más de una semana Aptitud para principiantes 35/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 45/100
Todos los issues de coder/clistat
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
theagentrouter/agent-router#2926 ·
Los mantenedores suelen responder en 1 día
-
meta
Dificultad 2/5 1-3 horas Aptitud para principiantes 64/100
last9/last9-mcp-server#443 ·
Los mantenedores suelen responder en 2 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 83/100
ray-project/kuberay#5454 ·
-
deriveTargetPodsForParentNP continues with an empty PolicyEndpoint on non-NotFound Get errorsAbiertobug
Dificultad 2/5 1-3 horas Aptitud para principiantes 80/100
aws/aws-network-policy-agent#723 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
FootprintAI/Containarium#3182 ·
Los mantenedores suelen responder en 1 día