Skip to content

HTTP/2: Drain queued frames stranded by a writability change during flush (#17279) - #17281

Merged
normanmaurer merged 1 commit into
5.0from
h2_5
Aug 13, 2026
Merged

normanmaurer merged 1 commit into
5.0from
h2_5

Conversation

@normanmaurer

Copy link
Copy Markdown
Member

Motivation:

The inFlush guard added in #17266 (fixing livelock #17256) drops a
flush that
re-enters via a synchronous writability change. But when
writePendingBytes()
leaves frames queued and the following ctx.flush() drains the transport
and
flips the channel writable mid-flush, that dropped flush was the only
signal to
write the rest — so large writes (e.g. a multi-MiB gRPC body) hang.

Modification:

  • Gate the writability-driven flush: channelWritabilityChanged only
    flushes when
    the remote flow controller still has frames queued, so a writability
    toggle
    with nothing to write (e.g. SslHandler during setup) can't drive the
    flush -> writability -> flush livelock (Netty HTTP/2 client livelock — reentrant flush during pipeline setup #17256).
  • flush() re-runs while a flush was requested reentrantly while it was
    running,
    honoring it regardless of writability; the inFlush guard turns that
    reentrancy
    into iteration rather than recursion.

Result:

Large HTTP/2 writes no longer stall on a mid-flush writability flip, and

…lush (#17279)

Motivation:

The `inFlush` guard added in #17266 (fixing livelock #17256) drops a
flush that
re-enters via a synchronous writability change. But when
writePendingBytes()
leaves frames queued and the following ctx.flush() drains the transport
and
flips the channel writable mid-flush, that dropped flush was the only
signal to
write the rest — so large writes (e.g. a multi-MiB gRPC body) hang.

Modification:

- Gate the writability-driven flush: channelWritabilityChanged only
flushes when
the remote flow controller still has frames queued, so a writability
toggle
  with nothing to write (e.g. SslHandler during setup) can't drive the
  flush -> writability -> flush livelock (#17256).
- flush() re-runs while a flush was requested reentrantly while it was
running,
honoring it regardless of writability; the inFlush guard turns that
reentrancy
  into iteration rather than recursion.

Result:

Large HTTP/2 writes no longer stall on a mid-flush writability flip, and
@testlens-app

testlens-app Bot commented Aug 13, 2026 •

Copy link
Copy Markdown

🚨 TestLens detected 1 failed test 🚨

Here is what you can do:

  1. Inspect the test failures carefully.
  2. If you are convinced that some of the tests are flaky, you can mute them below.
  3. Finally, trigger a rerun by checking the rerun checkbox.

Test Summary

Build PR / macos-aarch64-java25-boringssl build > Netty/Transport/Native/KQueue

Test Runs Flakiness
KQueueDatagramUnicastIPv6MappedTest > testSimpleSendCompositeDirectByteBuf(TestInfo) ❌ ✅ 5% 🟠
KQueueDatagramUnicastIPv6MappedTest > testSimpleSendCompositeHeapByteBuf(TestInfo) ❌ ✅ 1% 🟡

Build PR / macos-x86_64-java25-boringssl build > Netty/Transport/Native/KQueue

Test Runs Flakiness
KQueueDatagramUnicastIPv6MappedTest > testSimpleSendCompositeHeapByteBuf(TestInfo) ❌ ✅ 1% 🟡

Build PR / windows-x86_64-java25-boringssl > Netty/Buffer

Test Runs Flakiness
SlicedByteBufTest > testCopyMultipleThreads0() ⚠️ 🚫 0% 🟢

Build PR / windows-x86_64-java25-boringssl > Netty/Common

Test Runs Flakiness
AutoScalingEventExecutorChooserFactoryTest > testScaleUp() ✅ ❌ 1% 🟡

🏷️ Commit: 5885648
▶️ Tests: 2973 executed
⚪️ Checks: 12/12 completed

Test Failures

AutoScalingEventExecutorChooserFactoryTest > testScaleUp() (Netty/Common in Build PR / windows-x86_64-java25-boringssl)
org.opentest4j.AssertionFailedError: Should scale up to 2 after stressing one executor. ==> expected: <2> but was: <3>
	at org.junit.jupiter.api.AssertionFailureBuilder.build(AssertionFailureBuilder.java:151)
	at org.junit.jupiter.api.AssertionFailureBuilder.buildAndThrow(AssertionFailureBuilder.java:132)
	at org.junit.jupiter.api.AssertEquals.failNotEqual(AssertEquals.java:197)
	at org.junit.jupiter.api.AssertEquals.assertEquals(AssertEquals.java:150)
	at org.junit.jupiter.api.Assertions.assertEquals(Assertions.java:563)
	at io.netty.util.concurrent.AutoScalingEventExecutorChooserFactoryTest.testScaleUp(AutoScalingEventExecutorChooserFactoryTest.java:152)
	at java.base/java.lang.reflect.Method.invoke(Method.java:565)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1604)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1604)
expected actual
2 3

Muted Tests

Select tests to mute in this pull request:

  • AutoScalingEventExecutorChooserFactoryTest > testScaleUp()
  • KQueueDatagramUnicastIPv6MappedTest > testSimpleSendCompositeDirectByteBuf(TestInfo)
  • KQueueDatagramUnicastIPv6MappedTest > testSimpleSendCompositeHeapByteBuf(TestInfo)
  • SlicedByteBufTest > testCopyMultipleThreads0()

Reuse successful test results:

  • ♻️ Only rerun the tests that failed or were muted before

Click the checkbox to trigger a rerun:

  • Rerun jobs

Learn more about TestLens at testlens.app.

@normanmaurer
normanmaurer merged commit 50ebe4c into 5.0 Aug 13, 2026
19 of 23 checks passed
@normanmaurer
normanmaurer deleted the h2_5 branch August 13, 2026 13:06
@normanmaurer normanmaurer added this to the 5.0.0.Final milestone Aug 13, 2026
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