Repository navigation
test(http): drain the request in the provider stubs (issue #80 root cause) - #84
Merged
Merged
Conversation
…ause) Root cause, not a rerun. The three provider stubs read the socket once, then closed it. Under load the request arrives in more than one segment, so bytes stayed unread; closing a socket with unread receive data makes the kernel send RST, and the client surfaces that mid-body as `provider stream: error decoding response body`. The turn then failed with the durable error already correct — the durable event was there all along, my earlier diagnostic just queried the bare literal `session.error` while events are stored as `session.error@v1`. Evidence, same box, same concurrency, 8-way: pre-fix binary 15 / 96 runs failed post-fix binary 0 / 96 runs failed final binary 0 / 120 runs failed `drain_request` reads to `\r\n\r\n` plus the declared Content-Length, so the close is a FIN. Applied to `stall_gateway_data`, `stall_gateway` (whose negative control could otherwise pass for the wrong reason) and `free_tier_error`; `tests/stall.rs` holds sockets without responding and needs nothing. The test now also captures the code's own reason: a `tracing_subscriber` was missing, so every `tracing::error!` on the failure path was invisible and a failed turn was indistinguishable from a hung one. Test-only; no product code changed.
`drain_request` brings its own `use std::io::Read`; the per-stub import lists kept it and clippy -D warnings (CI runs --all-targets, my local run did not) rejected it on all three platforms.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #80 at the root. The flake was in the test harness, not the product.
Root cause
All three provider stubs did a single
stream.read(&mut buf)and then closed the socket. Under load the request arrives in more than one segment, so bytes stay unread in the receive queue. Closing a socket with unread receive data makes the kernel send RST instead of FIN, and the client surfaces that as:That is why it was load-dependent (never in isolation, ~30% at 8-way concurrency) and why it looked like a hang: the durable
session.errorwas written correctly, and my previous diagnostic reportedsession_errors=0only because it queried the bare literalsession.errorwhile events are stored assession.error@v1. The diagnostic is fixed too.Evidence
Same box, same 8-way concurrency:
Fix
drain_requestreads until\r\n\r\nplus the declaredContent-Length, so the close is a clean FIN. Applied tostall_gateway_data,stall_gateway(whose negative control could otherwise pass for the wrong reason) andfree_tier_error.tests/stall.rsdeliberately holds sockets without responding and needs nothing.Also installs a
tracing_subscriberin the test: without one, everytracing::error!on the failure path was invisible, so a failed turn and a hung turn were indistinguishable.Test-only. No product code changed. Full workspace suite green (125 suites).