Repository navigation
Conversation
📊 Automated PR Analysis
SummaryFixes a panic in the llm-proxy health probe where ureq 2.12.1 could panic buffering a short response body if a peer replied and closed the socket before the request was read (a macOS-specific race). The fix wraps the ureq call in catch_unwind to return false instead of panicking, and updates/adds tests in probe_identity to cover the race. Review Checklist
Linked issues: #4912 Analyzed automatically by wshm · This is an automated analysis, not a human review. |
aeppling
left a comment
There was a problem hiding this comment.
Hey @CG-5228, thanks for picking this up. Develop moved since you opened this: #4994 bumped ureq to 3, and the panic site this guards against (response.rs:401-403 in ureq 2.12.1) is gone. We reproduced the panic on your base (about 1% of early-close probes on macOS, with the same EINVAL as the issue) and saw none in 5,000 probes on develop, so the catch_unwind is no longer needed.
What's left from #4912 is the test half, which your PR already covers. The stub in probe_rejects_a_stranger_on_the_port still replies without reading the request, so the test can pass through a connection error instead of the identity check. Could you rebase on develop, drop the catch_unwind from llm_proxy.rs, and keep the two test changes (the stub that reads the request, and probe_survives_peer_closing_without_reading_request)? A test(llm-proxy): … title would then fit better, and it still closes #4912.
Summary
ureq::get(...).call()inllm_proxy::health_check_with_timeoutwithstd::panic::catch_unwind, returningfalseifureqpanics while buffering a short response body (LimitedRead::read_exact(...).expect(...)inureq 2.12.1when a peer writes a response and closes the socket before reading the request on macOS).hooks::session_start::probe_identity::probe_rejects_a_stranger_on_the_portto drain the incoming HTTP request before writing its stub response so the test exercises the identity check rather than racing socket close, and addprobe_survives_peer_closing_without_reading_requestto cover the early-close race directly.Closes #4912
Test Plan
cargo test --lib hooks::session_start::probe_identity