GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — HTTP/2: Drain queued frames stranded by a writability change during flush by bryce-anderson · Pull Request #17279 · netty/netty

Conversation

@bryce-anderson

@bryce-anderson bryce-anderson commented Aug 12, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

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 #17256
stays fixed.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@bryce-anderson
HTTP/2: Drain queued frames stranded by a writability change during f…
7b05104
…lush

Motivation:

The `inFlush` guard added in netty#17266 (fixing livelock netty#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#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 netty#17256
stays fixed.
@bryce-anderson bryce-anderson mentioned this pull request Aug 12, 2026
HTTP/2: Prevent reentrant flush on writability change #17266
Merged
@testlens-app

testlens-app Bot commented Aug 13, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

✅ All tests passed ✅

🏷️ Commit: 7b05104
▶️ Tests: 448046 executed
⚪️ Checks: 22/22 completed


Learn more about TestLens at testlens.app.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bryce-anderson

bryce-anderson commented Aug 13, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor Author

So, I think this will fix the stalls, but I'm still curious about how #17256 happens. The stack trace as described does look re-entrant, but if it were truly spinning like that it would stack-overflow immediately and that would be rather obvious. It could also be that something else was spinning synchronously (maybe a SslHandler loop just as a wild guess) forever and the trail of the trace is happenstance.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@normanmaurer normanmaurer added this to the 4.2.18.Final milestone Aug 13, 2026
@normanmaurer normanmaurer added needs-cherry-pick-4.1 This PR should be cherry-picked to 4.1 once merged. needs-cherry-pick-5.0 This PR should be cherry-picked to 5.0 once merged. labels Aug 13, 2026
normanmaurer
normanmaurer approved these changes Aug 13, 2026
View reviewed changes
@normanmaurer

normanmaurer commented Aug 13, 2026

Copy link
Copy Markdown
Member

@bryce-anderson I think we might just have "spinned" for some time and not long enough to get a stack overflow.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@normanmaurer
normanmaurer merged commit 67896b2 into netty:4.2 Aug 13, 2026
23 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@netty-project-bot

netty-project-bot commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Could not create auto-port PR.
Got conflicts when cherry-picking onto 5.0.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@netty-project-bot

netty-project-bot commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Auto-port PR for 4.1: #17280

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@netty-project-bot netty-project-bot mentioned this pull request Aug 13, 2026
Auto-port 4.1: HTTP/2: Drain queued frames stranded by a writability change during flush #17280
Merged
@github-actions github-actions Bot removed the needs-cherry-pick-4.1 This PR should be cherry-picked to 4.1 once merged. label Aug 13, 2026
@normanmaurer

normanmaurer commented Aug 13, 2026

Copy link
Copy Markdown
Member

PR for 5.0 #17281

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@arnabnandy7 arnabnandy7 mentioned this pull request Aug 13, 2026
HTTP/2: Test writability change during close #17284
Closed
normanmaurer added a commit that referenced this pull request Aug 13, 2026
@netty-project-bot @bryce-anderson @normanmaurer
Auto-port 4.1: HTTP/2: Drain queued frames stranded by a writability …
29e3d85
…change during flush (#17280)

Auto-port of #17279 to 4.1
Cherry-picked commit: 67896b2

---
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
#17256
stays fixed.

---------

Co-authored-by: Bryce Anderson <[email protected]>
Co-authored-by: Norman Maurer <[email protected]>
normanmaurer added a commit that referenced this pull request Aug 13, 2026
@normanmaurer @bryce-anderson
HTTP/2: Drain queued frames stranded by a writability change during f…
50ebe4c
…lush (#17279) (#17281)

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

Co-authored-by: Bryce Anderson <[email protected]>
@bryce-anderson
bryce-anderson deleted the bl_anderson/h2-flush-stall branch August 13, 2026 14:59
@chrisvest chrisvest removed the needs-cherry-pick-5.0 This PR should be cherry-picked to 5.0 once merged. label Aug 13, 2026
@lhotari lhotari mentioned this pull request Sep 10, 2026
[fix][sec] Upgrade Netty to 4.2.18 to address several CVEs and bugs apache/pulsar#26514
Merged
2 of 11 tasks
This was referenced Sep 16, 2026
Add regression test for close() cascade reentering flush() #17497
Merged
Netty HTTP/2 client livelock during close() — reentrant flush via channelWritabilityChanged, second variant not covered by #17266 #17276
Closed
normanmaurer added a commit that referenced this pull request Sep 16, 2026
@normanmaurer
Add regression test for close() cascade reentering flush() (#17497)
9b96442
Motivation:

The reentrancy fix landed in #17279 already covers this case, since
the inFlush/flushAgain guard in flush() now spans the whole call
rather than just individual iterations.

Modifications:

- adds the regression test from #17276 to lock in that behavior.

Result:

Better test coverage
This was referenced Sep 16, 2026
Auto-port 5.0: Add regression test for close() cascade reentering flush() #17504
Merged
Auto-port 4.1: Add regression test for close() cascade reentering flush() #17505
Merged
normanmaurer added a commit that referenced this pull request Sep 17, 2026
@netty-project-bot @normanmaurer
Auto-port 5.0: Add regression test for close() cascade reentering flu…
9472345
…sh() (#17504)

Auto-port of #17497 to 5.0
Cherry-picked commit: 9b96442

---
Motivation:

The reentrancy fix landed in #17279 already covers this case, since
the inFlush/flushAgain guard in flush() now spans the whole call
rather than just individual iterations.

Modifications:

- adds the regression test from #17276 to lock in that behavior.

Result:

Better test coverage

---------

Co-authored-by: Norman Maurer <[email protected]>
normanmaurer added a commit that referenced this pull request Sep 17, 2026
@netty-project-bot @normanmaurer
Auto-port 4.1: Add regression test for close() cascade reentering flu…
707791d
…sh() (#17505)

Auto-port of #17497 to 4.1
Cherry-picked commit: 9b96442

---
Motivation:

The reentrancy fix landed in #17279 already covers this case, since
the inFlush/flushAgain guard in flush() now spans the whole call
rather than just individual iterations.

Modifications:

- adds the regression test from #17276 to lock in that behavior.

Result:

Better test coverage

Co-authored-by: Norman Maurer <[email protected]>
ravi-signal pushed a commit to signalapp/Signal-Server that referenced this pull request Sep 23, 2026
@eager-signal @ravi-signal
Add tests for response backpressure and concurrent, large, responses
9bbd04a
The latter is a regression test for hangs (fixed in Netty 4.2.18,
netty/netty#17279) and response truncation.
@normanmaurer normanmaurer mentioned this pull request Oct 1, 2026
child5 #17695
Closed
lltopk pushed a commit to lltopk/netty that referenced this pull request Oct 24, 2026
@netty-project-bot @bryce-anderson
@normanmaurer @lltopk
Auto-port 4.1: HTTP/2: Drain queued frames stranded by a writability …
f26202e
…change during flush (netty#17280)

Auto-port of netty#17279 to 4.1
Cherry-picked commit: 67896b2

---
Motivation:

The `inFlush` guard added in netty#17266 (fixing livelock netty#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#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
netty#17256
stays fixed.

---------

Co-authored-by: Bryce Anderson <[email protected]>
Co-authored-by: Norman Maurer <[email protected]>
lltopk pushed a commit to lltopk/netty that referenced this pull request Oct 24, 2026
@netty-project-bot @normanmaurer @lltopk
Auto-port 4.1: Add regression test for close() cascade reentering flu…
8985e55
…sh() (netty#17505)

Auto-port of netty#17497 to 4.1
Cherry-picked commit: 9b96442

---
Motivation:

The reentrancy fix landed in netty#17279 already covers this case, since
the inFlush/flushAgain guard in flush() now spans the whole call
rather than just individual iterations.

Modifications:

- adds the regression test from netty#17276 to lock in that behavior.

Result:

Better test coverage

Co-authored-by: Norman Maurer <[email protected]>
@normanmaurer normanmaurer mentioned this pull request Oct 26, 2026
crisp nova cceda091 #18109
Closed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@normanmaurer normanmaurer normanmaurer approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

4.2.18.Final

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

4 participants

@bryce-anderson @normanmaurer @netty-project-bot @chrisvest
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.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.