[Bug]: /healthz with a query string triggers a heartbeat
Maintainer thường phản hồi trong vòng 1 ngày
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 25/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- typescript
Hướng nghiên cứu
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.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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.
- Ngôn ngữ chính
- TypeScript
- Star
- 79.9k
- Fork
- 6.9k
- Merge trung bình
- 20 giờ 21 phút
- Pull request đã merge (30 ngày)
- 51
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của coder/code-server
-
Error not trueĐang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 45/100
coder/code-server#8148 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 51/100
coder/code-server#8145 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 15/100
coder/code-server#8142 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[Bug]: --proxy-domain does not proxy when the host includes a portCó thể đã có người làm @adityajai119 đã nhận 10 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 35/100
coder/code-server#8128 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
enhancement
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 57/100
coder/code-server#8113 · 1 bình luận · 1 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của coder/code-server
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
vercel-labs/ui#1066 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
fix(factory-cockpit): display active agent/actor name instead of verbose step name in run card badgeĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
ranxianglei/billion-context#7597 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
documentation target:powerpoint
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 76/100
tomast1337/PdfLapas#602 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
kubernetes-ingestor: fetchCRDMapping() runs even when crossplane.enabled is false, logging a 403 ERROR every runCó thể đã có người làm @kc9ddi đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
TeraSky-OSS/backstage-plugins#228 ·