Repository navigation
fix(client): fail parked h2 request with connection error on close - #4275
Merged
seanmonstar merged 1 commit intoNov 16, 2026
Merged
Conversation
When the h2 connection drops while a request is still waiting for a stream slot, the parked callback was left to drop, and the caller got a misleading DispatchGone user error. Fail it with the connection error instead: canceled on a clean GOAWAY, the h2 reason otherwise. Adds a regression test with a server that only allows one concurrent stream and closes while the second request is parked. Fixes hyperium#4269
1 task done
jimeh
added a commit
to jimeh/connectrpc-ruby
that referenced
this pull request
Nov 24, 2026
…onnection end (#211) * fix(hyper): adopt hyper 1.13.0, which drains its request channel at connection end hyper 1.13.0 fixes hyperium/hyper#4202, the tokio send race behind #208: its HTTP/1.1 and HTTP/2 dispatchers now close and drain their request channel before the connection future completes (hyperium/hyper#4222, #4242). It is adopted one day after release under a one-off exception to the 7-day crate age rule, recorded in the plan's D16, after checking that the published crate matches the v1.13.0 tag and reading the 1.12.0..1.13.0 diff. Only hyper moves in the lock; the requirement floor follows it. hyper 1.13.0 also fails a request waiting for an HTTP/2 stream slot with the bare code of its connection's error (hyperium/hyper#4275), which the transport classified as a stream reset: gRPC `internal` or "stream reset" where the connection's other streams, and 1.12, reported a closed connection. A bare h2 code is now a connection failure, as h2 and grpc-go report one. A raw-peer spec fails the connection with DATA on stream 0 while a call waits for the slot. The stranded-request guard from #210 stays as a safety net for futures dropped unfinished; its comments, the README and the plan say what 1.13.0 now covers. * docs(hyper): qualify what hyper 1.13.0 drains and when a parked request gets a bare code An HTTP/1.1 upgrade completes without the channel drain, so the stranded guard still covers it alongside futures dropped unfinished. Only a connection error with a code other than NO_ERROR reaches a request waiting for a stream slot as a bare code; a graceful close and a keepalive timeout still read as a closed connection. The classification comment names the two other bare codes it also counts, and the new spec notes the dispatch gap it cannot rule out. The reproducer counts stay in the pull request. * docs(hyper): name every upgrade trigger and parked-request branch hyper's HTTP/1.1 client also upgrades on a 2xx reply to CONNECT, and an error without a code reaches a parked request as a cancellation. The CONNECT reset comment states hyper's exact condition, and the spec comment covers the whole window before hyper parks the request. * docs(hyper): narrow the upgrade, early-answer and spec-window wording A 204 reply to CONNECT is not an upgrade. hyper answers a request waiting for a slot early only when its dispatch finds the connection failed and keepalive has not timed out, and the spec's gap ends when the readiness poll checks for the connection error. * docs(hyper): record hyper 1.13.0 in the support profile and clarify failure docs The support profile's tested lock now names hyper 1.13.0. `reset_code` also carries a GOAWAY code h2 sent itself, as it already did, so its docs no longer say "received". The plan gives each parked-request outcome its own clause, and the README names the cases that can still strand a request. * test(hyper): park the queued call before corrupting its connection The stream-slot spec sent the corrupt frame after request:indexed, which fires before hyper's dispatch calls h2's send_request and parks the request; h2 processing the frame in that gap would fail the call through h2's GOAWAY error, which reads the same, so a pass could skip the slot path. A dispatch:returned:N hold point, counted when hyper's HTTP/2 connection future returns pending with N stream indexes taken, shows the poll that passed the queued call to h2 has ended. The spec now waits for it. It costs one atomic load per pending poll when nothing is armed. * docs(hyper): say when reset_code and dispatch:returned hold reset_code can carry a code h2 fails the connection with before h2 writes its own GOAWAY, and only the first dispatch:returned:N return after request N was indexed shows that request parked.
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.
When the h2 connection goes away while a request is waiting for a stream to open, the parked callback was never failed. It fell through to Callback::drop, so the caller saw a DispatchGone user error instead of the connection error.
Fail the parked callback in the poll_ready error branch instead: canceled on a clean GOAWAY, the h2 reason otherwise. The original error is still returned from the task.
Adds a regression test with a server that allows one concurrent stream and closes while the second request is parked. The test fails before this change with User(DispatchGone) and passes after.
Fixes #4269