Skip to content

Auto-port 4.1: HTTP/2: Prevent reentrant flush on writability change - #17268

Merged
normanmaurer merged 1 commit into
4.1from
auto-port-pr-17266-to-4.1
Aug 12, 2026
Merged

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

Conversation

@netty-project-bot

Copy link
Copy Markdown
Contributor

Auto-port of #17266 to 4.1
Cherry-picked commit: 1ec9af2


Motivation:

An HTTP/2 connection can enter a livelock when a flush synchronously triggers a channel writability change. channelWritabilityChanged then re-enters Http2ConnectionHandler.flush() while the original flush is still in progress, causing the event-loop thread to spin indefinitely.

Modification:

Track when Http2ConnectionHandler is performing a flush and prevent channelWritabilityChanged from initiating a nested flush during that operation.

Add a regression test that simulates a synchronous writability change during ChannelHandlerContext.flush() and verifies that the flush is not re-entered.

Result:

Fixes #17256.

Motivation:

An HTTP/2 connection can enter a livelock when a flush synchronously
triggers a channel writability change. `channelWritabilityChanged` then
re-enters `Http2ConnectionHandler.flush()` while the original flush is
still in progress, causing the event-loop thread to spin indefinitely.

Modification:

Track when `Http2ConnectionHandler` is performing a flush and prevent
`channelWritabilityChanged` from initiating a nested flush during that
operation.

Add a regression test that simulates a synchronous writability change
during `ChannelHandlerContext.flush()` and verifies that the flush is
not re-entered.

Result:

Fixes #17256.

Signed-off-by: Arnab Nandy <[email protected]>
(cherry picked from commit 1ec9af2)
@testlens-app

testlens-app Bot commented Aug 12, 2026 •

Copy link
Copy Markdown

✅ All tests passed ✅

🏷️ Commit: 9710845
▶️ Tests: 356954 executed
⚪️ Checks: 18/18 completed


Learn more about TestLens at testlens.app.

@normanmaurer normanmaurer added this to the 4.1.138.Final milestone Aug 12, 2026
@normanmaurer
normanmaurer merged commit 48c8075 into 4.1 Aug 12, 2026
18 of 19 checks passed
@normanmaurer
normanmaurer deleted the auto-port-pr-17266-to-4.1 branch August 12, 2026 12:49
lltopk pushed a commit to lltopk/netty that referenced this pull request Oct 24, 2026
…etty#17268)

Auto-port of netty#17266 to 4.1
Cherry-picked commit: 1ec9af2

---
Motivation:

An HTTP/2 connection can enter a livelock when a flush synchronously
triggers a channel writability change. `channelWritabilityChanged` then
re-enters `Http2ConnectionHandler.flush()` while the original flush is
still in progress, causing the event-loop thread to spin indefinitely.

Modification:

Track when `Http2ConnectionHandler` is performing a flush and prevent
`channelWritabilityChanged` from initiating a nested flush during that
operation.

Add a regression test that simulates a synchronous writability change
during `ChannelHandlerContext.flush()` and verifies that the flush is
not re-entered.

Result:

Fixes netty#17256.

Signed-off-by: Arnab Nandy <[email protected]>
Co-authored-by: Arnab Nandy <[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.

3 participants