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 — Auto-port 4.1: Reconcile `AbstractCoalescingBufferQueue` readableBytes when it drains, and fail stuck HTTP/2 streams instead of spinning empty DATA frames by netty-project-bot · Pull Request #16997 · netty/netty

Conversation

@netty-project-bot

@netty-project-bot netty-project-bot commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

Auto-port of #16947 to 4.1
Cherry-picked commit: a5d4f28


Motivation:

On a proxy doing HTTP/2 egress we OOMed when the remote flow controller spun writing empty DATA frames (~134M) into an already-unwritable channel. This is the OOM from #11959, still reachable on 4.2.12.Final despite #14220 - that fix only closed the exception-in-remove route and left two gaps:

  • CoalescingBufferQueue.remove(...) can leave readableBytes > 0 with an empty deque -> it decrements by a buffer's live readable bytes, and its empty-queue early return asserts rather than reconciles
  • Also writeAllocatedBytes re-writes a frame that makes no progress without ever checking channel writability.

Full investigation and heap dump in #16946.

Modification:

  • AbstractCoalescingBufferQueue - add a reconcileReadableBytes() (called at the remove(...) early return and after the drain loop) so an empty queue always reports 0 readable bytes.
  • DefaultHttp2RemoteFlowController.writeAllocatedBytes - if the head frame is given a positive budget but is neither removed nor shrinks across two consecutive iterations, fail the stream via cancel path instead.
  • Tests cover the queue desync, the stuck-frame spin (failing the stream), and a single no-progress pass (tolerated).

Result:

The queue can't report bytes it can't produce, and the flow controller can't emit empty DATA frames unboundedly - a wedged stream fails cleanly instead of OOMing the connection. No public API change.

Fixes #16946

Sorry, something went wrong.

Uh oh!

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

All reactions
@gavinbunney @normanmaurer @netty-project-bot
Reconcile AbstractCoalescingBufferQueue readableBytes when it drain…
71ed2eb
…s, and fail stuck HTTP/2 streams instead of spinning empty DATA frames (#16947)

**Motivation:**

On a proxy doing HTTP/2 egress we OOMed when the remote flow controller
spun writing empty DATA frames (~134M) into an already-unwritable
channel. This is the OOM from #11959, still reachable on `4.2.12.Final`
despite #14220 - that fix only closed the exception-in-`remove` route
and left two gaps:

* `CoalescingBufferQueue.remove(...)` can leave `readableBytes > 0` with
an empty deque -> it decrements by a buffer's *live* readable bytes, and
its empty-queue early return asserts rather than reconciles
* Also `writeAllocatedBytes` re-writes a frame that makes no progress
without ever checking channel writability.

Full investigation and heap dump in #16946.

**Modification:**

* `AbstractCoalescingBufferQueue` - add a `reconcileReadableBytes()`
(called at the `remove(...)` early return and after the drain loop) so
an empty queue always reports 0 readable bytes.
* `DefaultHttp2RemoteFlowController.writeAllocatedBytes` - if the head
frame is given a positive budget but is neither removed nor shrinks
across two consecutive iterations, fail the stream via cancel path
instead.
* Tests cover the queue desync, the stuck-frame spin (failing the
stream), and a single no-progress pass (tolerated).

**Result:**

The queue can't report bytes it can't produce, and the flow controller
can't emit empty DATA frames unboundedly - a wedged stream fails cleanly
instead of OOMing the connection. No public API change.

Fixes #16946

---------

Co-authored-by: Norman Maurer <[email protected]>
(cherry picked from commit a5d4f28)
@netty-project-bot netty-project-bot mentioned this pull request Jun 25, 2026
Reconcile AbstractCoalescingBufferQueue readableBytes when it drains, and fail stuck HTTP/2 streams instead of spinning empty DATA frames #16947
Merged
@normanmaurer normanmaurer added this to the 4.1.136.Final milestone Jun 26, 2026
@normanmaurer
normanmaurer merged commit 26bb273 into 4.1 Jun 26, 2026
19 checks passed

Uh oh!

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

@normanmaurer
normanmaurer deleted the auto-port-pr-16947-to-4.1 branch June 26, 2026 07:31
lltopk pushed a commit to lltopk/netty that referenced this pull request Oct 24, 2026
@netty-project-bot @gavinbunney
@normanmaurer @lltopk
Auto-port 4.1: Reconcile AbstractCoalescingBufferQueue readableByte…
24e57cf
…s when it drains, and fail stuck HTTP/2 streams instead of spinning empty DATA frames (netty#16997)

Auto-port of netty#16947 to 4.1
Cherry-picked commit: a5d4f28

---
**Motivation:**

On a proxy doing HTTP/2 egress we OOMed when the remote flow controller
spun writing empty DATA frames (~134M) into an already-unwritable
channel. This is the OOM from netty#11959, still reachable on `4.2.12.Final`
despite netty#14220 - that fix only closed the exception-in-`remove` route
and left two gaps:

* `CoalescingBufferQueue.remove(...)` can leave `readableBytes > 0` with
an empty deque -> it decrements by a buffer's *live* readable bytes, and
its empty-queue early return asserts rather than reconciles
* Also `writeAllocatedBytes` re-writes a frame that makes no progress
without ever checking channel writability.

Full investigation and heap dump in netty#16946.

**Modification:**

* `AbstractCoalescingBufferQueue` - add a `reconcileReadableBytes()`
(called at the `remove(...)` early return and after the drain loop) so
an empty queue always reports 0 readable bytes.
* `DefaultHttp2RemoteFlowController.writeAllocatedBytes` - if the head
frame is given a positive budget but is neither removed nor shrinks
across two consecutive iterations, fail the stream via cancel path
instead.
* Tests cover the queue desync, the stuck-frame spin (failing the
stream), and a single no-progress pass (tolerated).

**Result:**

The queue can't report bytes it can't produce, and the flow controller
can't emit empty DATA frames unboundedly - a wedged stream fails cleanly
instead of OOMing the connection. No public API change.

Fixes netty#16946

Co-authored-by: Gavin Bunney <[email protected]>
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

Reviewers

No reviews

Uh oh!

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

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

4.1.136.Final

Development

Successfully merging this pull request may close these issues.

Uh oh!

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

3 participants

@netty-project-bot @normanmaurer @gavinbunney
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.