Tree builds endpoint exhausts memory and took production down
Los mantenedores suelen responder en 2 días
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 35/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Área
- api, backend, databases, infrastructure, performance
Línea de trabajo
Start with backend/kernelCI_app/queries/tree.py and treeDetailsBuildsView._sanitize_rows; trace how the builds endpoint fetches and filters rows, then compare that with the response fields it uses. The issue identifies filtering in SQL, selecting fewer columns, and bounding or paginating results as the proper fix; done means large tree requests no longer exhaust backend memory and the endpoint can be re-enabled.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Summary
GET /api/tree/<tree>/<branch>/<commit_hash>/builds exhausts backend memory on large trees and took production down on 2026-10-27 (dashboard.kernelci.org and staging, ~21:50–22:17 UTC). The VM had to be hard-restarted.
Why this is an emergency
- Production and staging share one 8 GB VM. One heavy request on this endpoint can freeze the whole host: web, API and SSH all become unreachable.
- It is not load-related. Normal browsing of a linux-next commit page is enough, so it will happen again.
- It has been happening for days: serial console shows repeated OOM kills of gunicorn workers at 1–2 GB RSS each, the latest ~5 days before this outage.
Evidence
- Azure metrics: available memory 4.6 GB → 1.3 GB at 18:26 UTC (never freed). At 21:48, ~360 MB in from DB and CPU 90%. By 21:51, 70 MB free, disk reads pinned at 132 MB/s (thrashing). CPU credits were full, so this is not throttling.
- The last API request completed at 21:48:21, after which the host was unresponsive.
- nginx, 2026-10-27: 49 client aborts (499) on this endpoint:
next/master×28,android14-6.1-lts×12,stable-rc/linux-5.10.y×8. The 18:26 memory drop coincides with a 499 on/api/tree/next/master/<sha>/builds.
Root cause
get_tree_data(data_type="builds") (backend/kernelCI_app/queries/tree.py):
- joins builds × incidents × issues for the checkout;
- selects large text columns (
misc,comment,command,log_url); fetchall()s everything, then appliesfilter_*params in Python (treeDetailsBuildsView._sanitize_rows).
On top of that, gunicorn has 5 workers per backend × 2 backends, no --max-requests, no container memory limit and a 250 s timeout. Workers keep working after the client disconnects and never release memory.
Fix
- Immediate workaround: disable the endpoint (503), recycle workers, cap backend memory. Must be merged and deployed within 24 h.
- Proper fix: push filters into SQL, select only the columns the response needs, bound or paginate the result, then re-enable the endpoint.
- Follow-up: move staging off the production host (as was discussed on meetings), or we might make it on-demand
- Lenguaje dominante
- Python
- Estrellas
- 10
- Forks
- 32
- Merge medio
- 4 d 7 min
- PR fusionados (30 d)
- 31
Preparar el entorno
- Incluye un Dockerfile o un archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
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 kernelci/dashboard
-
notifications
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
Los mantenedores suelen responder en 2 días
-
Dificultad 4/5 3-5 días Aptitud para principiantes 45/100
Los mantenedores suelen responder en 2 días
-
HW-list: origin and lab filters on the listingPosiblemente ocupada @alanpeixinho la tomó hace 65 días. Abierto
Dificultad 4/5 3-5 días Aptitud para principiantes 25/100
Los mantenedores suelen responder en 2 días
-
Backend
Dificultad 5/5 Más de una semana Aptitud para principiantes 35/100
Los mantenedores suelen responder en 2 días
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 15/100
Los mantenedores suelen responder en 2 días
Todos los issues de kernelci/dashboard
Issues similares
-
enhancement help wanted
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
Git-Hospital/githealthcheck#61 ·
Los mantenedores suelen responder en 1 día
-
changelog investigate
Dificultad 2/5 1-3 horas Aptitud para principiantes 67/100
ramnes/notion-sdk-py#433 ·
-
Partial method descriptors raise on class accessPosiblemente ocupada @Gambit-Checkmate la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
Los mantenedores suelen responder en 19 días
-
docs pkg:core
Dificultad 1/5 Menos de una hora Aptitud para principiantes 84/100
pydantic/pydantic-ai#11929 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
intake/intake-esm#789 ·