Repository navigation
Fix an HTTP/2 stream I/O error ending the other streams on its connection - #7564
Merged
Merged
Conversation
joviegas
force-pushed
the
joviegas/h2-timeout-retry-connection
branch
from
November 17, 2026 21:27
fccce32 to
753dba6
Compare
joviegas
force-pushed
the
joviegas/h2-timeout-retry-connection
branch
from
November 18, 2026 00:47
753dba6 to
32a9656
Compare
alextwoods
reviewed
Nov 18, 2026
joviegas
force-pushed
the
joviegas/h2-timeout-retry-connection
branch
from
November 18, 2026 17:44
1411cae to
886fcc8
Compare
zoewangg
reviewed
Nov 18, 2026
joviegas
force-pushed
the
joviegas/h2-timeout-retry-connection
branch
4 times, most recently
from
November 18, 2026 21:40
14a9384 to
b9eeaa1
Compare
joviegas
force-pushed
the
joviegas/h2-timeout-retry-connection
branch
from
November 18, 2026 21:47
b9eeaa1 to
f3365a1
Compare
zoewangg
approved these changes
Nov 19, 2026
alextwoods
approved these changes
Nov 19, 2026
|
This pull request has been closed and the conversation has been locked. Comments on closed PRs are hard for our team to see. If you need more assistance, please open a new issue that references this one. |
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Motivation and Context
Http2SettingsFrameHandlercloses it first. Other streams fail or return a partial body with no error. A GOAWAY that refuses an in-flight stream does the same.Http2MultiplexedChannelPoolshould close a retired connection once its last stream ends, but the check inreleasemisses that last release. A failed stream acquire skips the check entirely, so a connection that gets a GOAWAY with no open streams stays open. Fixing 1 alone would leave every retired connection open, so both fixes ship together.client.close()truncates in-flight streams. Streams close without an error, so a body with no Content-Length comes back partial.Modifications
IOExceptionorTimeoutException,Http2StreamExceptionHandlernow callsMultiplexedChannelRecord.closeToNewStreams()instead of sending an exception through the pipeline, so no handler can close the connection. A GOAWAY now ends only the streams above the last stream ID and leaves the rest running.MultiplexedChannelRecordcloses a retired connection when it has no open streams and no pending acquires. The check runs on the event loop after every release, failed acquire, retire, GOAWAY, and idle check.closeIfIdlenow checks for retirement first. It used to zero the available stream count, so a retired connection never looked drained. An acquire on a retired connection now fails with the reason: a GOAWAY or an I/O error on another stream.client.close()fails in-flight streams. Each in-flight stream fails with anIOExceptioncaused byClosedChannelException, the same error a server-side close produces.Behavior changes:
When one HTTP/2 request hits a read timeout, the SDK stops sending new requests on that connection and closes it after the requests already on it finish. Before, the timeout closed the connection at once, so those requests failed or returned a partial body. Now they succeed.
If the connection itself is dead, its other requests now fail at the next unanswered health-check PING (sent every 5 s by default) or at their own read timeout, not at the first timeout. The SDK retries them on a new connection. The cost is that delay, on a connection that is already broken.
Closing the client while HTTP/2 requests are in flight now fails those requests with an
IOException. Before, they completed with a partial body and no error. Code that waits for its requests to finish before closing the client sees no change.Testing
Added and updated JUnit tests
AI tools
License