Tree builds endpoint exhausts memory and took production down
メンテナーはふだん 2 日以内に返信
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 35/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 領域
- api, backend, databases, infrastructure, performance
調査の方向性
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.
索引モデルが issue の本文から書いたものです。
説明
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
- 主要言語
- Python
- スター
- 10
- フォーク
- 32
- 平均マージ
- 4日 7分
- マージ済み PR(30日)
- 31
環境構築
- Dockerfile または Docker Compose ファイルあり
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
kernelci/dashboard のほかの issue
-
notifications
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
メンテナーはふだん 2 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 45/100
メンテナーはふだん 2 日以内に返信
-
HW-list: origin and lab filters on the listing対応中かも @alanpeixinho が 65 日前に担当しました。 オープン
難易度 4/5 3〜5日 初心者へのやさしさ 25/100
メンテナーはふだん 2 日以内に返信
-
Backend
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
メンテナーはふだん 2 日以内に返信
-
難易度 5/5 1週間以上 初心者へのやさしさ 15/100
メンテナーはふだん 2 日以内に返信
kernelci/dashboard の issue をすべて見る
似ている issue
-
enhancement help wanted
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
Git-Hospital/githealthcheck#61 ·
メンテナーはふだん 1 日以内に返信
-
changelog investigate
難易度 2/5 1〜3時間 初心者へのやさしさ 67/100
ramnes/notion-sdk-py#433 ·
-
Partial method descriptors raise on class access対応中かも @Gambit-Checkmate が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
メンテナーはふだん 19 日以内に返信
-
docs pkg:core
難易度 1/5 1時間未満 初心者へのやさしさ 84/100
pydantic/pydantic-ai#11929 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
intake/intake-esm#789 ·