Repository navigation
Http2ConnectionHandler: report at most one stream error for a CompositeStreamException - #17470
Conversation
…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.
|
I think most peers would also tolerate the old behavior but it's still not correct and wasteful as well.. |
| // 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(); |
There was a problem hiding this comment.
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.
…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.
…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.
🚨 TestLens detected 2 failed tests 🚨Here is what you can do:
Test SummaryBuild PR / linux-x86_64-java26 build > Netty/Codec/HTTP2
Build PR / macos-x86_64-java11-boringssl build > Netty/Transport/Native/KQueue
🏷️ Commit: d20aacc Test FailuresHttp2MultiplexTransportTest (Netty/Codec/HTTP2 in Build PR / linux-x86_64-java26 build)KQueueDatagramUnicastIPv6MappedTest > testSimpleSendWithConnect(TestInfo) (Netty/Transport/Native/KQueue in Build PR / macos-x86_64-java11-boringssl build)Rerun ControlsSelect tests to mute in this pull request:
Reuse successful test results:
Click the checkbox to trigger a rerun:
Learn more about TestLens at testlens.app/docs. |
|
Auto-port PR for 4.1: #17595 |
|
Auto-port PR for 5.0: #17596 |
…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]>
…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]>
…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]>
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:
contained in a CompositeStreamException instead of iterating and
reporting every one of them.
Result:
Only one RST_STREAM is written per CompositeStreamException, in line
with the RFC 9113 recommendation.