Repository navigation
fix(net): give the RP peer server the same stall budget as its client (#3899) - #4372
Conversation
`--net-peer` failed intermittently -- about two runs in five, on master
and on unrelated branches alike -- with the RP's HTTP server taking
complete headers and then none of a 4096-byte body:
POST /echo 4096-byte FNV-1a -> 408, received_bytes: 0
{'lastTimeoutWasStall': True, 'lastTimeoutElapsedMs': 2006,
'lastTimeoutBodyLength': 0, 'lastTimeoutExpectedBody': 4096,
'lastTimeoutHeadersComplete': True}
2006 ms against a 2000 ms budget: the peer missed by six milliseconds.
`kRpHttpClientStallMs` was raised 2000 -> 6000 in #4231 after five
requests at 2706-3586 ms were shown to complete correctly, all under the
peer's own 5000 ms handler ceiling. `kRpPeerStallMs` was left at 2000 so
a dead connection would be reaped quickly. That treats the budget as a
property of which side we are, when it is a property of the peer: the C6
services a request from its sketch main loop and blocks up to 5000 ms
doing it, so a gap over 2000 ms is ordinary in either direction. The
failure above is that same distribution seen from the other end.
Set to 6000 to match the client rather than to clear the observed
2006 ms -- the value comes from the peer's documented ceiling, not from
the symptom. A dead connection is still reaped: kRpPeerMaxRequestMs
(10000) is unchanged and is the absolute ceiling. The cost is that a
dead peer holds the single-client server for up to 6 s rather than 2 s
before that applies.
Measured on the attached pair, 10 reconnect cycles per run:
before master 2 pass / 1 fail
unrelated branch 1 pass / 1 fail
after 6 runs 6 pass, 0 stalls
Six clean runs against a ~40% failure rate is roughly a 1-in-20
coincidence, so this is strong but not proof for a fault of this shape;
the six-millisecond miss is what carries it.
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01KkufoNxfnNRU9psT3R9F51
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (1)
Included review availability: Your plan provides up to 8 included reviews per hour; 7 remain after this review. 📝 WalkthroughWalkthroughThe RP2350W CYW43 peer server now waits 6 seconds for peer activity instead of 2 seconds. The 10-second maximum request duration remains unchanged. ChangesRP2350 peer timeout
Priority: ⬇️ Low Estimated code review effort: 1 (Trivial) | ~5 minutes Change: Bug fix Merge Risk: ⚪ Minimal · up to Slow RP peers receive sufficient time to send request bodies, while inactive requests remain bounded by the existing maximum duration. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Evidence strengthened: 9/9 cleanI described the original result as "strong but not proof" — six clean runs against a ~40% failure rate is roughly a 1-in-20 coincidence, which is suggestive rather than conclusive for a fault whose defining property is intermittence. Three more runs:
Baseline: 2 failures in 5 runs. With the fix: 0 in 9. At that rate nine consecutive clean runs is about a 1-in-100 coincidence, so the result is now conclusive rather than suggestive, and the description's hedge can be read as superseded. The mechanism remains what carries it — Cost is unchanged and still real: a dead peer occupies the single-client server for up to 6 s rather than 2 s before |
--net-peerfails intermittently — about two runs in five, on master and on unrelated branches alike — with the RP's HTTP server taking complete headers and then none of a 4096-byte body:2006 ms against a 2000 ms budget. The peer missed by six milliseconds.
The asymmetry
The client side was raised 2000 → 6000 in #4231, and its comment records why: five requests at 2706, 2734, 2961, 3108 and 3586 ms completed correctly, each of which the old value would have failed, with the maximum sitting under the peer's own 5000 ms ceiling.
kRpPeerStallMswas deliberately left at 2000 so a dead connection would be reaped quickly. That reasoning treats the budget as a property of which side we are, when it is a property of the peer — the C6 services a request from its sketch main loop and blocks up to 5000 ms doing it, so a gap over 2000 ms is ordinary in either direction. The failure above is the same distribution observed from the other end.Why 6000 and not 2500
6000 matches
kRpHttpClientStallMs, which was derived independently from the peer's documented 5000 ms handler ceiling. Picking a value that merely clears the observed 2006 ms would be fitting the threshold to the symptom — and would leave the next 3586 ms request failing exactly as before.Cost, stated
A genuinely dead peer now holds the single-client server for up to 6 s rather than 2 s before
kRpPeerMaxRequestMs(10000, unchanged) reaps it. That is the trade the original comment was protecting, and it is real; the absolute ceiling still bounds it.Measured
Attached pair, 10 reconnect cycles per run:
Six clean runs against a ~40% failure rate is roughly a 1-in-20 coincidence — strong but not proof for a fault of this shape. The six-millisecond miss is what carries it; the runs corroborate.
bash lintclean.Found while running a regression control for #4343, where this failure initially looked like a regression in that PR until master reproduced it identically.
🤖 Generated with Claude Code
https://claude.ai/code/session_01KkufoNxfnNRU9psT3R9F51
Summary by CodeRabbit