Repository navigation
Fix flaky HttpToHttp2ConnectionHandlerTest.testChunkedRequestWithBodyAndTrailingHeaders - #17590
Merged
Merged
Conversation
Motivation: HttpToHttp2ConnectionHandlerTest.testChunkedRequestWithBodyAndTrailingHeaders writes two HttpContent chunks for the same stream and asserted that exactly one onDataRead(...) call was observed on the server side with the two payloads concatenated into a single DATA frame. Whether the two writeData(...) calls get merged into one physical DATA frame by DefaultHttp2RemoteFlowController's pending-write-queue coalescing is a timing-dependent internal optimization, not a guarantee of the codec. When the merge does not happen in time, two separate DATA frames are delivered instead, which is spec-compliant but failed the test's strict Mockito verify(times(1)) expectation. Modifications: - Verify onDataRead(...) is invoked atLeastOnce() instead of exactly once - Assert the concatenation of all received buffers matches the sent payload instead of assuming a single buffer Result: The test no longer depends on the timing of the flow controller's DATA frame coalescing and reliably passes regardless of whether the two chunks are delivered as one or two DATA frames.
Member
Author
|
Fix for a racy test. |
✅ All tests passed ✅🏷️ Commit: bb8f304 Learn more about TestLens at testlens.app/docs. |
Member
Author
|
Let me fix this as it is just a test fix |
Contributor
|
Auto-port PR for 5.0: #17592 |
Contributor
|
Auto-port PR for 4.1: #17593 |
normanmaurer
added a commit
that referenced
this pull request
Sep 22, 2026
…RequestWithBodyAndTrailingHeaders (#17592) Auto-port of #17590 to 5.0 Cherry-picked commit: bb3eb5f --- Motivation: HttpToHttp2ConnectionHandlerTest.testChunkedRequestWithBodyAndTrailingHeaders writes two HttpContent chunks for the same stream and asserted that exactly one onDataRead(...) call was observed on the server side with the two payloads concatenated into a single DATA frame. Whether the two writeData(...) calls get merged into one physical DATA frame by DefaultHttp2RemoteFlowController's pending-write-queue coalescing is a timing-dependent internal optimization, not a guarantee of the codec. When the merge does not happen in time, two separate DATA frames are delivered instead, which is spec-compliant but failed the test's strict Mockito verify(times(1)) expectation. Modifications: - Verify onDataRead(...) is invoked atLeastOnce() instead of exactly once - Assert the concatenation of all received buffers matches the sent payload instead of assuming a single buffer Result: The test no longer depends on the timing of the flow controller's DATA frame coalescing and reliably passes regardless of whether the two chunks are delivered as one or two DATA frames. Co-authored-by: Norman Maurer <[email protected]>
normanmaurer
added a commit
that referenced
this pull request
Sep 22, 2026
…RequestWithBodyAndTrailingHeaders (#17593) Auto-port of #17590 to 4.1 Cherry-picked commit: bb3eb5f --- Motivation: HttpToHttp2ConnectionHandlerTest.testChunkedRequestWithBodyAndTrailingHeaders writes two HttpContent chunks for the same stream and asserted that exactly one onDataRead(...) call was observed on the server side with the two payloads concatenated into a single DATA frame. Whether the two writeData(...) calls get merged into one physical DATA frame by DefaultHttp2RemoteFlowController's pending-write-queue coalescing is a timing-dependent internal optimization, not a guarantee of the codec. When the merge does not happen in time, two separate DATA frames are delivered instead, which is spec-compliant but failed the test's strict Mockito verify(times(1)) expectation. Modifications: - Verify onDataRead(...) is invoked atLeastOnce() instead of exactly once - Assert the concatenation of all received buffers matches the sent payload instead of assuming a single buffer Result: The test no longer depends on the timing of the flow controller's DATA frame coalescing and reliably passes regardless of whether the two chunks are delivered as one or two DATA frames. Co-authored-by: Norman Maurer <[email protected]>
lltopk
pushed a commit
to lltopk/netty
that referenced
this pull request
Oct 24, 2026
…RequestWithBodyAndTrailingHeaders (netty#17593) Auto-port of netty#17590 to 4.1 Cherry-picked commit: bb3eb5f --- Motivation: HttpToHttp2ConnectionHandlerTest.testChunkedRequestWithBodyAndTrailingHeaders writes two HttpContent chunks for the same stream and asserted that exactly one onDataRead(...) call was observed on the server side with the two payloads concatenated into a single DATA frame. Whether the two writeData(...) calls get merged into one physical DATA frame by DefaultHttp2RemoteFlowController's pending-write-queue coalescing is a timing-dependent internal optimization, not a guarantee of the codec. When the merge does not happen in time, two separate DATA frames are delivered instead, which is spec-compliant but failed the test's strict Mockito verify(times(1)) expectation. Modifications: - Verify onDataRead(...) is invoked atLeastOnce() instead of exactly once - Assert the concatenation of all received buffers matches the sent payload instead of assuming a single buffer Result: The test no longer depends on the timing of the flow controller's DATA frame coalescing and reliably passes regardless of whether the two chunks are delivered as one or two DATA frames. Co-authored-by: Norman Maurer <[email protected]>
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.
Motivation:
HttpToHttp2ConnectionHandlerTest.testChunkedRequestWithBodyAndTrailingHeaders
writes two HttpContent chunks for the same stream and asserted that
exactly one onDataRead(...) call was observed on the server side with
the two payloads concatenated into a single DATA frame. Whether the two
writeData(...) calls get merged into one physical DATA frame by
DefaultHttp2RemoteFlowController's pending-write-queue coalescing is a
timing-dependent internal optimization, not a guarantee of the codec.
When the merge does not happen in time, two separate DATA frames are
delivered instead, which is spec-compliant but failed the test's strict
Mockito verify(times(1)) expectation.
Modifications:
once
payload instead of assuming a single buffer
Result:
The test no longer depends on the timing of the flow controller's DATA
frame coalescing and reliably passes regardless of whether the two
chunks are delivered as one or two DATA frames.