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 — Http2ConnectionHandler: report at most one stream error for a CompositeStreamException by normanmaurer · Pull Request #17470 · netty/netty

Conversation

@normanmaurer

@normanmaurer normanmaurer commented Sep 14, 2026

Copy link
Copy Markdown
Member

Motivation:

RFC 9113, Section 5.4 states that implementations SHOULD report at
most one stream and one connection error as a result of processing a
single condition, even if multiple errors are discovered. When
DefaultHttp2LocalFlowController accumulates per-stream failures (e.g.
while applying a new SETTINGS initial window size) into a single
CompositeStreamException, Http2ConnectionHandler.onError iterated all
contained StreamExceptions and wrote an RST_STREAM for each one,
exceeding the recommended limit of one stream error per result.

Modifications:

  • Http2ConnectionHandler.onError only reports the first StreamException
    contained in a CompositeStreamException instead of iterating and
    reporting every one of them.
  • Add unit tests

Result:

Only one RST_STREAM is written per CompositeStreamException, in line
with the RFC 9113 recommendation.

Sorry, something went wrong.

Uh oh!

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

All reactions
@normanmaurer
Http2ConnectionHandler: report at most one stream error for a Composi…
0b9738b
…teStreamException

Motivation:

RFC 9113, Section 5.4 states that implementations SHOULD report at
most one stream and one connection error as a result of processing a
single condition, even if multiple errors are discovered. When
DefaultHttp2LocalFlowController accumulates per-stream failures (e.g.
while applying a new SETTINGS initial window size) into a single
CompositeStreamException, Http2ConnectionHandler.onError iterated all
contained StreamExceptions and wrote an RST_STREAM for each one,
exceeding the recommended limit of one stream error per result.

Modifications:

- Http2ConnectionHandler.onError only reports the first StreamException
  contained in a CompositeStreamException instead of iterating and
  reporting every one of them.
- Add unit tests

Result:

Only one RST_STREAM is written per CompositeStreamException, in line
with the RFC 9113 recommendation.
@normanmaurer
normanmaurer requested review from bryce-anderson, ejona86 and violetagg September 14, 2026 10:39
@normanmaurer normanmaurer added this to the 4.2.19.Final milestone Sep 14, 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 Sep 14, 2026
@normanmaurer

normanmaurer commented Sep 14, 2026

Copy link
Copy Markdown
Member Author

I think most peers would also tolerate the old behavior but it's still not correct and wasteful as well..

All reactions

Sorry, something went wrong.

Uh oh!

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

violetagg
violetagg approved these changes Sep 14, 2026
View reviewed changes
@normanmaurer
Merge branch '4.2' into h2-comp-a6552f04
1c89a76
bryce-anderson
bryce-anderson reviewed Sep 21, 2026
View reviewed changes
Comment thread codec-http2/src/main/java/io/netty/handler/codec/http2/Http2ConnectionHandler.java Resolved

Uh oh!

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

Comment thread codec-http2/src/main/java/io/netty/handler/codec/http2/Http2ConnectionHandler.java Resolved

Uh oh!

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

Comment thread codec-http2/src/main/java/io/netty/handler/codec/http2/Http2ConnectionHandler.java Outdated
// and "implementations SHOULD report at most one stream and one connection error as a result".
// Only report the first stream error out of the composite instead of one RST_STREAM per contained
// error, even though multiple streams may be affected by the condition that produced the composite.
Iterator<StreamException> iterator = compositException.iterator();

@bryce-anderson bryce-anderson Sep 21, 2026

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think for the more general case we have de-dup logic below in the resetStream method: https://github.com/netty/netty/blob/4.2/codec-http2/src/main/java/io/netty/handler/codec/http2/Http2ConnectionHandler.java#L835-L838.

Unfortunately it suffers from being to fast and streams are removed from the connection before the next reset occurs. ☹️

Sorry, something went wrong.

Uh oh!

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

All reactions
normanmaurer added 2 commits September 22, 2026 15:34
@normanmaurer
Http2ConnectionHandler: keep resetting every stream in a CompositeStr…
55e9bc5
…eamException

Motivation:

Bryce Anderson pointed out on PR #17470 that the previous commit's
change to only report the first StreamException contained in a
CompositeStreamException is incorrect for the actual production code
path: DefaultHttp2LocalFlowController's WindowUpdateVisitor builds a
CompositeStreamException while applying a new
SETTINGS_INITIAL_WINDOW_SIZE across all active streams, adding at most
one StreamException per distinct, independently affected stream. If
only the first were reported, the remaining affected streams would be
left open with a corrupted flow-control window instead of being reset.

The RFC 9113, Section 5.4 guidance to report at most one stream error
is about not sending multiple redundant reports for the same
underlying violation; it does not apply across genuinely independent
errors on different streams. That guidance is already satisfied here
since each stream contributes at most one exception to the composite.
The quote attributed to the RFC in the previous commit's comment was
also not an accurate quotation of the spec text.

Modifications:

- Revert Http2ConnectionHandler.onError to reset every stream
  contained in a CompositeStreamException, restoring the pre-#17470
  behavior, and document why that is correct.
- Update the accompanying test to assert that every affected stream is
  reset.

Result:

Each independently affected stream is still correctly reset when a
CompositeStreamException is thrown from flow-control window
processing.
@normanmaurer
Http2ConnectionHandler: dedup stream errors by stream id within a Com…
d20aacc
…positeStreamException

Motivation:

Every StreamException currently contained in a CompositeStreamException
belongs to a distinct stream, so resetting each one individually is
correct. However, nothing enforced RFC 9113, Section 5.4's guidance to
report at most one stream error per stream if a composite were ever to
contain more than one StreamException for the same stream id.

Modifications:

- Track which stream ids have already been handled while iterating a
  CompositeStreamException in Http2ConnectionHandler.onError, and skip
  any subsequent StreamException for a stream id that was already
  reported.
- Add a test that verifies only the first StreamException for a given
  stream id results in a RST_STREAM.

Result:

At most one stream error is reported per stream id contained in a
CompositeStreamException.
@normanmaurer
normanmaurer requested a review from bryce-anderson September 22, 2026 13:44
@testlens-app

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

Uh oh!

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

Copy link
Copy Markdown

🚨 TestLens detected 2 failed tests 🚨

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 / linux-x86_64-java26 build > Netty/Codec/HTTP2

Test Runs Flakiness
Http2MultiplexTransportTest ❌ 1% 🟡

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

Test Runs Flakiness
KQueueDatagramUnicastIPv6MappedTest > testSimpleSendWithConnect(TestInfo) ❌ 4% 🟡

🏷️ Commit: d20aacc
▶️ Tests: 469566 executed
⚪️ Checks: 26/26 completed

Test Failures

Http2MultiplexTransportTest (Netty/Codec/HTTP2 in Build PR / linux-x86_64-java26 build)
java.lang.IllegalStateException: Possible memory leak detected for resource scope 'Http2MultiplexTransportTest'. Please use paranoid leak detection to get more information, or set -Dio.netty.util.LeakPresenceDetector.trackCreationStack=true
	at io.netty.util.LeakPresenceDetector$ResourceScope.check(LeakPresenceDetector.java:308)
	at io.netty.util.LeakPresenceDetector$ResourceScope.close(LeakPresenceDetector.java:328)
	at io.netty.util.test.LeakPresenceExtension.afterAll(LeakPresenceExtension.java:140)
	at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:511)
	at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1450)
	at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:2019)
	at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:187)
KQueueDatagramUnicastIPv6MappedTest > testSimpleSendWithConnect(TestInfo) (Netty/Transport/Native/KQueue in Build PR / macos-x86_64-java11-boringssl build)
org.opentest4j.AssertionFailedError
	at io.netty.testsuite.transport.socket.DatagramUnicastTest.testSimpleSendWithConnect0(DatagramUnicastTest.java:430)
	at io.netty.testsuite.transport.socket.DatagramUnicastTest.testSimpleSendWithConnect(DatagramUnicastTest.java:383)
	at io.netty.testsuite.transport.socket.DatagramUnicastTest.testSimpleSendWithConnect(DatagramUnicastTest.java:212)
	at io.netty.testsuite.transport.socket.DatagramUnicastTest$7.run(DatagramUnicastTest.java:206)
	at io.netty.testsuite.transport.socket.DatagramUnicastTest$7.run(DatagramUnicastTest.java:203)
	at io.netty.testsuite.transport.AbstractComboTestsuiteTest.run(AbstractComboTestsuiteTest.java:52)
	at io.netty.testsuite.transport.socket.DatagramUnicastTest.testSimpleSendWithConnect(DatagramUnicastTest.java:203)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1541)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1541)

Rerun Controls

Select tests to mute in this pull request:

  • Http2MultiplexTransportTest
  • KQueueDatagramUnicastIPv6MappedTest > testSimpleSendWithConnect(TestInfo)

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/docs.

All reactions

Sorry, something went wrong.

Uh oh!

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

bryce-anderson
bryce-anderson approved these changes Sep 22, 2026
View reviewed changes
@normanmaurer
normanmaurer merged commit 9676719 into 4.2 Sep 22, 2026
25 of 27 checks passed

Uh oh!

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

@normanmaurer
normanmaurer deleted the h2-comp-a6552f04 branch September 22, 2026 16:58
@netty-project-bot

netty-project-bot commented Sep 22, 2026

Copy link
Copy Markdown
Contributor

Auto-port PR for 4.1: #17595

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 Sep 22, 2026
Auto-port 4.1: Http2ConnectionHandler: report at most one stream error for a CompositeStreamException #17595
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 Sep 22, 2026
@netty-project-bot

netty-project-bot commented Sep 22, 2026

Copy link
Copy Markdown
Contributor

Auto-port PR for 5.0: #17596

All reactions

Sorry, something went wrong.

Uh oh!

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

@github-actions github-actions Bot removed the needs-cherry-pick-5.0 This PR should be cherry-picked to 5.0 once merged. label Sep 22, 2026
@netty-project-bot netty-project-bot mentioned this pull request Sep 22, 2026
Auto-port 5.0: Http2ConnectionHandler: report at most one stream error for a CompositeStreamException #17596
Merged
normanmaurer added a commit that referenced this pull request Sep 22, 2026
@netty-project-bot @normanmaurer
Auto-port 5.0: Http2ConnectionHandler: report at most one stream erro…
9656c24
…r for a CompositeStreamException (#17596)

Auto-port of #17470 to 5.0
Cherry-picked commit: 9676719

---
Motivation:

RFC 9113, Section 5.4 states that implementations SHOULD report at
most one stream and one connection error as a result of processing a
single condition, even if multiple errors are discovered. When
DefaultHttp2LocalFlowController accumulates per-stream failures (e.g.
while applying a new SETTINGS initial window size) into a single
CompositeStreamException, Http2ConnectionHandler.onError iterated all
contained StreamExceptions and wrote an RST_STREAM for each one,
exceeding the recommended limit of one stream error per result.

Modifications:

- Http2ConnectionHandler.onError only reports the first StreamException
  contained in a CompositeStreamException instead of iterating and
  reporting every one of them.
- Add unit tests

Result:

Only one RST_STREAM is written per CompositeStreamException, in line
with the RFC 9113 recommendation.

---------

Co-authored-by: Norman Maurer <[email protected]>
normanmaurer added a commit that referenced this pull request Sep 22, 2026
@netty-project-bot @normanmaurer
Auto-port 4.1: Http2ConnectionHandler: report at most one stream erro…
cc81744
…r for a CompositeStreamException (#17595)

Auto-port of #17470 to 4.1
Cherry-picked commit: 9676719

---
Motivation:

RFC 9113, Section 5.4 states that implementations SHOULD report at
most one stream and one connection error as a result of processing a
single condition, even if multiple errors are discovered. When
DefaultHttp2LocalFlowController accumulates per-stream failures (e.g.
while applying a new SETTINGS initial window size) into a single
CompositeStreamException, Http2ConnectionHandler.onError iterated all
contained StreamExceptions and wrote an RST_STREAM for each one,
exceeding the recommended limit of one stream error per result.

Modifications:

- Http2ConnectionHandler.onError only reports the first StreamException
  contained in a CompositeStreamException instead of iterating and
  reporting every one of them.
- Add unit tests

Result:

Only one RST_STREAM is written per CompositeStreamException, in line
with the RFC 9113 recommendation.

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: Http2ConnectionHandler: report at most one stream erro…
7b39bb7
…r for a CompositeStreamException (netty#17595)

Auto-port of netty#17470 to 4.1
Cherry-picked commit: 9676719

---
Motivation:

RFC 9113, Section 5.4 states that implementations SHOULD report at
most one stream and one connection error as a result of processing a
single condition, even if multiple errors are discovered. When
DefaultHttp2LocalFlowController accumulates per-stream failures (e.g.
while applying a new SETTINGS initial window size) into a single
CompositeStreamException, Http2ConnectionHandler.onError iterated all
contained StreamExceptions and wrote an RST_STREAM for each one,
exceeding the recommended limit of one stream error per result.

Modifications:

- Http2ConnectionHandler.onError only reports the first StreamException
  contained in a CompositeStreamException instead of iterating and
  reporting every one of them.
- Add unit tests

Result:

Only one RST_STREAM is written per CompositeStreamException, in line
with the RFC 9113 recommendation.

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

@violetagg violetagg violetagg approved these changes
@bryce-anderson bryce-anderson bryce-anderson approved these changes
@ejona86 ejona86 Awaiting requested review from ejona86

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.19.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

@normanmaurer @netty-project-bot @violetagg @bryce-anderson
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.