[Bug]: /healthz with a query string triggers a heartbeat
Mantenedores costumam responder em até 1 dia
Avaliação
- Dificuldade
- 2/5
- Tempo estimado
- 1-3 horas
- Facilidade para iniciantes
- 25/100
- Tipo de issue
- Bug
- Clareza
- Claramente especificada
- Status de atividade
- Ativa
- Stack de tecnologia
- typescript
Direção de pesquisa
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.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
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.
- Linguagem predominante
- TypeScript
- Estrelas
- 79.9k
- Forks
- 6.9k
- Merge médio
- 20h 21min
- PRs com merge (30d)
- 51
Preparar o ambiente
- Sem Dockerfile nem arquivo Docker Compose
- Tem um modelo de pull request
- Ler o guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de coder/code-server
-
Error not trueAberta
Dificuldade 3/5 1-2 dias Facilidade para iniciantes 45/100
coder/code-server#8148 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 51/100
coder/code-server#8145 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 15/100
coder/code-server#8142 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
-
[Bug]: --proxy-domain does not proxy when the host includes a portTalvez já em andamento @adityajai119 assumiu há 10 dias. Aberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 35/100
coder/code-server#8128 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
-
enhancement
Dificuldade 3/5 1-2 dias Facilidade para iniciantes 57/100
coder/code-server#8113 · 1 comentário · 1 reação ·
Mantenedores costumam responder em até 1 dia
Todas as issues de coder/code-server
Issues semelhantes
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
vercel-labs/ui#1066 ·
Mantenedores costumam responder em até 1 dia
-
fix(factory-cockpit): display active agent/actor name instead of verbose step name in run card badgeAberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 72/100
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 68/100
ranxianglei/billion-context#7597 ·
Mantenedores costumam responder em até 1 dia
-
documentation target:powerpoint
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 76/100
tomast1337/PdfLapas#602 ·
Mantenedores costumam responder em até 1 dia
-
kubernetes-ingestor: fetchCRDMapping() runs even when crossplane.enabled is false, logging a 403 ERROR every runTalvez já em andamento @kc9ddi assumiu hoje. Aberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 76/100
TeraSky-OSS/backstage-plugins#228 ·