Repository navigation
HTTP/2: Release compressors after failed headers writes (#17253) - #17264
Merged
Merged
Conversation
`CompressorHttp2ConnectionEncoder` creates an `EmbeddedChannel` before delegating a HEADERS write. A delegate may fail the promise without throwing and without creating a stream, for example when a client writes headers with an invalid even stream ID. In that case, the compressor is never attached to a stream and is not released by `onStreamRemoved`. A compressor can also be left open if the delegate throws after compressor creation, or if target content encoding preparation fails. - Keep ownership of newly created compressors until they are attached to a stream. - Release compressors that are not attached after either `writeHeaders` overload returns or throws. - Release partially initialized compressors if header preparation fails. - Add regression tests for both overloads covering missing streams, synchronous and asynchronous failures, and existing streams in invalid states. Failed HEADERS writes no longer leave compression `EmbeddedChannel`s open, while compressors attached to streams continue to be released by the existing stream-removal path. - `./mvnw -pl codec-http2 -Dtest=CompressorHttp2ConnectionEncoderTest test` - `./mvnw -pl codec-http2 -Dtest=CompressorHttp2ConnectionEncoderTest,DataCompressionHttp2Test test` - `./mvnw -pl codec-http2 test`
✅ All tests passed ✅🏷️ Commit: 1756b79 Learn more about TestLens at testlens.app. |
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.
CompressorHttp2ConnectionEncodercreates anEmbeddedChannelbeforedelegating a HEADERS write. A delegate may fail the promise without
throwing and without creating a stream, for example when a client writes
headers with an invalid even stream ID. In that case, the compressor is
never attached to a stream and is not released by
onStreamRemoved.A compressor can also be left open if the delegate throws after
compressor creation, or if target content encoding preparation fails.
a stream.
writeHeadersoverload returns or throws.
synchronous and asynchronous failures, and existing streams in invalid
states.
Failed HEADERS writes no longer leave compression
EmbeddedChannelsopen, while compressors attached to streams continue to be released by
the existing stream-removal path.
./mvnw -pl codec-http2 -Dtest=CompressorHttp2ConnectionEncoderTest test./mvnw -pl codec-http2 -Dtest=CompressorHttp2ConnectionEncoderTest,DataCompressionHttp2Test test./mvnw -pl codec-http2 test