Skip to content

Auto-port 4.1: Fix flaky HttpToHttp2ConnectionHandlerTest.testChunkedRequestWithBodyAndTrailingHeaders - #17593

Merged
normanmaurer merged 1 commit into
4.1from
auto-port-pr-17590-to-4.1
Sep 22, 2026
Merged

normanmaurer merged 1 commit into
4.1from
auto-port-pr-17590-to-4.1

Conversation

@netty-project-bot

Copy link
Copy Markdown
Contributor

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.

…AndTrailingHeaders (#17590)

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.

(cherry picked from commit bb3eb5f)
@testlens-app

testlens-app Bot commented Sep 22, 2026 •

Copy link
Copy Markdown

✅ All tests passed ✅

🏷️ Commit: 3445703
▶️ Tests: 380690 executed
⚪️ Checks: 18/18 completed


Learn more about TestLens at testlens.app/docs.

@normanmaurer
normanmaurer merged commit 76bac45 into 4.1 Sep 22, 2026
19 checks passed
@normanmaurer
normanmaurer deleted the auto-port-pr-17590-to-4.1 branch September 22, 2026 17:42
@normanmaurer normanmaurer added this to the 4.1.139.Final milestone Sep 22, 2026
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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants