[Bug]: /healthz with a query string triggers a heartbeat
メンテナーはふだん 1 日以内に返信
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 25/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- typescript
調査の方向性
Read the heartbeat middleware in src/node/routes/index.ts and the unit-test setup mentioned in the report. Reproduce with /healthz?probe=1 followed by /healthz and check the heartbeat state. Done means the query-string health check does not trigger a heartbeat, and a test covers that behavior; the author says they are opening a PR with a fix and test.
索引モデルが issue の本文から書いたものです。
説明
Is there an existing issue for this?
- I have searched the existing issues
OS/Web Information
- Web Browser: not needed, reproduced with the unit tests
- Local OS: Windows 11
- Remote OS: Windows 11
- Remote Architecture: x64
code-server --version:mainat dda09f2
Steps to Reproduce
- Start code-server, for example with
--auth none. - Request
/healthzwith any query string, for exampleGET /healthz?probe=1, as a monitor or load balancer that adds a cache-busting or probe parameter does. - Request
/healthzagain.
Expected
As the FAQ says, /healthz reports the status "without triggering a heartbeat", so an idle instance stays expired with lastHeartbeat: 0, the heartbeat file is not touched, and --idle-timeout-seconds still shuts it down.
Actual
Three requests in a row against an idle instance on main (dda09f2), from the unit test setup with --auth=none:
GET /healthz -> {"status":"expired","lastHeartbeat":0}
GET /healthz?probe=1 -> {"status":"alive","lastHeartbeat":1794543674997}
GET /healthz -> {"status":"alive","lastHeartbeat":1794543674997}
The middleware in src/node/routes/index.ts that skips the heartbeat for health checks matches the path against req.url, which includes the query string:
if (!/^\/healthz\/?$/.test(req.url)) {
heart.beat()
}
So /healthz?probe=1 is treated as activity: it sets lastHeartbeat, touches the heartbeat file and cancels the idle shutdown timer. A monitor that polls with a query string more often than --idle-timeout-seconds keeps the instance from ever shutting down, and anything that watches the heartbeat file sees it as in use.
Logs
Not applicable.
Screenshot/Video
No response
Does this bug reproduce in native VS Code?
This cannot be tested in native VS Code
Does this bug reproduce in VS Code web?
This cannot be tested in VS Code web
Does this bug reproduce in GitHub Codespaces?
This cannot be tested in GitHub Codespaces
Are you accessing code-server over a secure context?
- I am using a secure context.
Notes
The fix is to match req.path, which has no query string. I am opening a PR with the fix and a test.
AI-assisted: found and reproduced with an AI coding agent; the check above was run locally.
- 主要言語
- TypeScript
- スター
- 79.9k
- フォーク
- 6.9k
- 平均マージ
- 20時間 21分
- マージ済み PR(30日)
- 51
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
coder/code-server のほかの issue
-
Error not trueオープン
難易度 3/5 1〜2日 初心者へのやさしさ 45/100
coder/code-server#8148 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 51/100
coder/code-server#8145 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 15/100
coder/code-server#8142 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
[Bug]: --proxy-domain does not proxy when the host includes a port対応中かも @adityajai119 が 10 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 35/100
coder/code-server#8128 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
enhancement
難易度 3/5 1〜2日 初心者へのやさしさ 57/100
coder/code-server#8113 · コメント 1 件 · リアクション 1 件 ·
メンテナーはふだん 1 日以内に返信
coder/code-server の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
vercel-labs/ui#1066 ·
メンテナーはふだん 1 日以内に返信
-
fix(factory-cockpit): display active agent/actor name instead of verbose step name in run card badgeオープン
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
ranxianglei/billion-context#7597 ·
メンテナーはふだん 1 日以内に返信
-
documentation target:powerpoint
難易度 1/5 1時間未満 初心者へのやさしさ 76/100
tomast1337/PdfLapas#602 ·
メンテナーはふだん 1 日以内に返信
-
kubernetes-ingestor: fetchCRDMapping() runs even when crossplane.enabled is false, logging a 403 ERROR every run対応中かも @kc9ddi が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
TeraSky-OSS/backstage-plugins#228 ·