Repository navigation
Description
Summary
When a UDP tracker answers the health check with a datagram that is not a valid tracker response, GET /health_check panics instead of reporting an error for that service. The HTTP connection is dropped and the client gets no report at all, not even for the other services.
Found on 2026-11-15 during the red-then-green check of #2393 (EPIC #2392). It is out of scope there, because that implementation only touches tests.
What happens
torrust_tracker_client::udp::client::check(packages/tracker-client/src/udp/client.rs) sends a connect request and racesclient.receive()against a 2 s sleep.- The reply does not parse, so
receive()correctly returnsErr(Error::UnableToParseResponse { .. }). checkcallsprocess(response.unwrap())and the check task panics.- In
packages/axum-health-check-api-server/src/handlers.rs, the per-service task panics on.expect("it should be able to join into the checking function"), and the handler panics on.expect("it should be able to connect to the job"). - The router has no panic-catching layer, so the connection is dropped (
hyper::Error(IncompleteMessage)on the client side).
check already returns Err("Timed Out") and Err("Did not Connect") for the other failure modes, and the endpoint reports other failed services as status Error with an Err(..) detail. A closed UDP port does not panic: it reports Timed Out.
Reproduction
Reproduced on develop at abd7a10ff with a temporary integration test that registers a UDP socket answering every datagram with the bytes junk, checked by the production Launcher::check. The test code, commands and output are in the issue spec's manual-verification-evidence.md and evidence/ folder (spec-only PR to follow).
Proposed fix
checkreturnsErr(..)naming the cause whenreceive()fails, instead of panicking; fix its stale# Panicsdoc comment.- The health-check handler reports a check job that panicked or was cancelled (
JoinError) as a failed check for that service, and the outer join does not panic. The report then has statusErrorwith the other services' results intact. - Regression tests, each proven red first: a
tracker-clientunit test with a junk-answering socket, and a health-check contract test with a probe whose job panics.
Spec-first: the specification goes in a spec-only PR before any code.
Activity
docs(issues): [torrust#2867] list the UDP launcher among the spec's r…
docs(issues): [torrust#2867] record spec-only PR 2868 in the spec fro…
docs(pr-reviews): [torrust#2867] log the resolution of the first PR 2…
docs(issues): [torrust#2867] name both deadlines that bound the await…
docs(issues): [torrust#2867] plan the junk-reply UDP contract test th…
docs(issues): [torrust#2867] state which temporary tests V1 and V2 ra…
docs(issues): [torrust#2867] assert the Timed Out value of the closed…
docs(issues): [torrust#2867] correct the round-two timestamps to the …
docs(pr-reviews): [torrust#2867] log the resolution of the first da2c…
docs(issues): [#2867] move the UDP health check panic spec to open
Merge #2868: docs(issues): [#2867] add spec for the UDP health check …
docs(pr-reviews): [torrust#2867] record the deferred second da2ce7 re…
docs(issues): [torrust#2867] correct four timestamps written ahead of…
docs(issues): [torrust#2867] say which test-file state the T5 red run…
docs(pr-reviews): [torrust#2867] state when the maintainer approved d…
14 remaining items
Merge torrust#2879: fix(tracker-client): [torrust#2867] report an inv…
docs(issues): [torrust#2866] point two specs from develop at the move…
Merge #2883: chore(issues): [#2393] archive the closed issue spec and…
chore(issues): archive closed issue torrust#2867 spec to docs/issues/…
docs(pr-reviews): [torrust#2867] close the PR 2868 follow-up findings…
docs(pr-reviews): [torrust#2867] cite the fix commit as the resolutio…
docs(issues): [torrust#2867] leave the reviewer checkpoint open
docs(pr-reviews): [torrust#2867] audit the first da2ce7 review of PR …
docs(pr-reviews): [torrust#2867] record the Copilot review of PR 2885…
docs(pr-reviews): [torrust#2867] audit the second da2ce7 review of PR…
Merge #2886: refactor(skills): [#2866] move the agent skills to .clau…
Merge torrust/torrust-tracker develop into 2867-close-out
docs(pr-reviews): [torrust#2867] link the PR 2885 audit to the moved …
Merge #2885: chore(issues): [#2867] close out the UDP health-check pa…