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: HTTP/2: Fix stream stall when toggling auto-read on a child channel by netty-project-bot · Pull Request #17646 · netty/netty

Conversation

@netty-project-bot

@netty-project-bot netty-project-bot commented Sep 28, 2026

Copy link
Copy Markdown
Contributor

Auto-port of #17617 to 4.1
Cherry-picked commit: ee269f5


Motivation:

When setAutoRead() is called on an Http2StreamChannel from a different EventLoop than the one the channel is registered to (e.g., a proxy mirroring writability state between streams on different connections), a race condition can occur. This leaves the stream stalled indefinitely because the auto-read state change may be reordered against or race with read-processing on the stream channel's own EventLoop, preventing the channel from resuming reads and sending flow-control WINDOW_UPDATE frames.

This issue is described in #17600.

Modification:

Modified AbstractHttp2StreamChannel.Http2StreamChannelConfig.setAutoRead() to ensure the auto-read state change is always applied on the channel's own EventLoop, similar to how AUTO_STREAM_FLOW_CONTROL is handled. The method now:

  1. Checks if the channel is registered and if the current thread is on the channel's EventLoop
  2. If so, applies the change immediately via setAutoRead0()
  3. If not, schedules the change to run on the channel's EventLoop via execute()

This ensures thread-safe, EventLoop-confined updates to the auto-read state, preventing races with concurrent read-processing.

Added a comprehensive test crossThreadSetAutoReadResumesStalledStream() that reproduces the issue: it disables auto-read before data arrives (causing the stream to stall once the 64KiB flow-control window is exhausted), then re-enables auto-read from a foreign EventLoop. The test verifies that the stream resumes and delivers the complete response body.

Result:

Fixes #17600. Http2StreamChannel can now safely have its auto-read state toggled from any thread without risking a stalled stream. The fix maintains EventLoop-confinement for all state changes while allowing cross-thread calls to proceed safely.

Sorry, something went wrong.

Uh oh!

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

All reactions
@pandareen @normanmaurer @netty-project-bot
HTTP/2: Fix stream stall when toggling auto-read on a child channel (#…
3a4b453
…17617)

Motivation:

When `setAutoRead()` is called on an `Http2StreamChannel` from a
different EventLoop than the one the channel is registered to (e.g., a
proxy mirroring writability state between streams on different
connections) we can end up not flushing the window update frame.

Modification:

- Ensure the window update frame is always flushed
- Add unit tests

Result:

Fixes #17600.

---------

Co-authored-by: Norman Maurer <[email protected]>
(cherry picked from commit ee269f5)
@netty-project-bot netty-project-bot mentioned this pull request Sep 28, 2026
HTTP/2: Fix stream stall when toggling auto-read on a child channel #17617
Merged
@normanmaurer
Fix compile error
6b4fb23
@testlens-app

testlens-app Bot commented Sep 28, 2026 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown

🚨 All tests passed but jobs failed 🚨

Failed Jobs without Test Failures

❌ Build PR / linux-x86_64-java11-boringssl build

🏷️ Commit: 6b4fb23
▶️ Tests: 306202 executed
⚪️ Checks: 18/18 completed

Rerun Controls

Click the checkbox to trigger a rerun:

  • Rerun jobs

Learn more about TestLens at testlens.app/docs.

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.1.139.Final milestone Sep 28, 2026
@normanmaurer
normanmaurer merged commit c04f8e9 into 4.1 Sep 28, 2026
18 of 19 checks passed

Uh oh!

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

@normanmaurer
normanmaurer deleted the auto-port-pr-17617-to-4.1 branch September 28, 2026 16:58
lltopk pushed a commit to lltopk/netty that referenced this pull request Oct 24, 2026
@netty-project-bot @pandareen
@normanmaurer @lltopk
Auto-port 4.1: HTTP/2: Fix stream stall when toggling auto-read on a …
068e146
…child channel (netty#17646)

Auto-port of netty#17617 to 4.1
Cherry-picked commit: ee269f5

---
Motivation:

When `setAutoRead()` is called on an `Http2StreamChannel` from a
different EventLoop than the one the channel is registered to (e.g., a
proxy mirroring writability state between streams on different
connections), a race condition can occur. This leaves the stream stalled
indefinitely because the auto-read state change may be reordered against
or race with read-processing on the stream channel's own EventLoop,
preventing the channel from resuming reads and sending flow-control
WINDOW_UPDATE frames.

This issue is described in netty#17600.

Modification:

Modified
`AbstractHttp2StreamChannel.Http2StreamChannelConfig.setAutoRead()` to
ensure the auto-read state change is always applied on the channel's own
EventLoop, similar to how `AUTO_STREAM_FLOW_CONTROL` is handled. The
method now:

1. Checks if the channel is registered and if the current thread is on
the channel's EventLoop
2. If so, applies the change immediately via `setAutoRead0()`
3. If not, schedules the change to run on the channel's EventLoop via
`execute()`

This ensures thread-safe, EventLoop-confined updates to the auto-read
state, preventing races with concurrent read-processing.

Added a comprehensive test
`crossThreadSetAutoReadResumesStalledStream()` that reproduces the
issue: it disables auto-read before data arrives (causing the stream to
stall once the 64KiB flow-control window is exhausted), then re-enables
auto-read from a foreign EventLoop. The test verifies that the stream
resumes and delivers the complete response body.

Result:

Fixes netty#17600. Http2StreamChannel can now safely have its auto-read state
toggled from any thread without risking a stalled stream. The fix
maintains EventLoop-confinement for all state changes while allowing
cross-thread calls to proceed safely.

---------

Co-authored-by: pandareen <[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.139.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 @pandareen
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.