Skip to content

HTTP2: change the default reset code from no error to internal error - #42269

Merged
wbpcode merged 9 commits into
envoyproxy:mainfrom
wbpcode:dev-fix-http2-error
Dec 4, 2025
Merged

wbpcode merged 9 commits into
envoyproxy:mainfrom
wbpcode:dev-fix-http2-error

Conversation

@wbpcode

@wbpcode wbpcode commented Nov 26, 2025

Copy link
Copy Markdown
Member

Commit Message: HTTP2: change the default reset code from no error to internal error
Additional Description:

This PR makes Envoy generate less NO_ERROR from the codec when there is a stream reset to close #36200.

https://httpwg.org/specs/rfc9113.html#RST_STREAM
https://httpwg.org/specs/rfc9113.html#ErrorCodes

Thanks so much for the great work from @botengyao in the #40729

Risk Level: mid.
Testing: unit + integration
Docs Changes:
Release Notes:
Platform Specific Features:
[Optional Runtime guard:]
[Optional Fixes #Issue]
[Optional Fixes commit #PR or SHA]
[Optional Deprecated:]
[Optional API Considerations:]

@repokitteh-read-only

Copy link
Copy Markdown

CC @envoyproxy/runtime-guard-changes: FYI only for changes made to (source/common/runtime/runtime_features.cc).

🐱

Caused by: #42269 was opened by wbpcode.

see: more, trace.

Comment on lines -897 to +924
codec_callbacks_->onCodecLowLevelReset();
// TODO(wbpcode): this ensure that onCodecLowLevelReset is only called once. But
// we should replace this with a better design later.
// See https://github.com/envoyproxy/envoy/issues/42264 for why we need this.
if (!codec_low_level_reset_is_called_) {
codec_low_level_reset_is_called_ = true;
codec_callbacks_->onCodecLowLevelReset();
}

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This PR changed the default stream reset code and will enlarger the problem in the #42264. So, I made a quick work around to resolve problem here.

@wbpcode

wbpcode commented Nov 26, 2025 •

Copy link
Copy Markdown
Member Author

Compare to the change in the #40729, this PR removed all RemoteResetNoError related things. This is because:

  1. error code from remote is untrustable anyway. The server or client may have similar problem of Envoy and abuse NO_ERROR.
  2. upstream remote reset no error not means that we can reset the downstream stream with NO_ERROR because the retrying, L7 filter chain processing and so on.
  3. In the Envoy, the resetStream() should only be called when there is an error. And any other normal response or completion, the end stream flag should be used in the frame.

@wbpcode

wbpcode commented Nov 27, 2025

Copy link
Copy Markdown
Member Author

/retest

@mattklein123

Copy link
Copy Markdown
Member

At a high level this makes sense to me: send NO_ERROR only if the response is complete. I don't have the time to analyze the details on this so will defer to others on that.

@botengyao botengyao left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks @wbpcode for driving this! Here is a quick pass, and I will take an additional look this weekend, and the CI is legit for ogHTTP2 + ngHTTP2 + UHV.

/wait

Comment thread source/common/http/http2/codec_impl.cc Resolved
Signed-off-by: wbpcode <[email protected]>

@botengyao botengyao left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

thanks! lgtm overall module one concern.

/wait

Comment thread source/common/http/conn_manager_impl.cc Outdated
Comment on lines +274 to +278
Runtime::runtimeFeatureEnabled("envoy.reloadable_features.reset_with_error");
// We should not propagate UpstreamProtocolError to downstream as that indicates
// an error on the upstream connection and may have nothing to do with the downstream.
// But we do need to handle DownstreamProtocolError which indicates a protocol error
// on the downstream connection.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Emm, I understand the use of resetStream() is to downstream, but still think we need to propagate the ProtocolError if there are either DownstreamProtocolError or UpstreamProtocolError, and keep consistent as before. If you are strong with this, would an additional PR with a new runtime guard, saying that UpstreamProtocolError is rest with LocalRest be better?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I reverted it and left a TODO there.

@botengyao

Copy link
Copy Markdown
Member

/retest

Signed-off-by: wbpcode <[email protected]>
@wbpcode

wbpcode commented Dec 3, 2025

Copy link
Copy Markdown
Member Author

/retest

botengyao
botengyao previously approved these changes Dec 3, 2025

@botengyao botengyao left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for improving this behavior @wbpcode.

RyanTheOptimist
RyanTheOptimist previously approved these changes Dec 3, 2025
@wbpcode
wbpcode dismissed stale reviews from RyanTheOptimist and botengyao via 44990ec December 4, 2025 02:27
@wbpcode
wbpcode enabled auto-merge (squash) December 4, 2025 02:28
@wbpcode

wbpcode commented Dec 4, 2025

Copy link
Copy Markdown
Member Author

/retest

@wbpcode
wbpcode merged commit 8f0bc15 into envoyproxy:main Dec 4, 2025
@wbpcode
wbpcode deleted the dev-fix-http2-error branch December 4, 2025 03:46
botengyao added a commit that referenced this pull request Dec 19, 2025
related to #42269

Commit Message:
Additional Description:
Risk Level:
Testing:
Docs Changes:
Release Notes:
Platform Specific Features:

---------

Signed-off-by: Boteng Yao <[email protected]>
grnmeira pushed a commit to grnmeira/envoy that referenced this pull request Mar 20, 2026
…nvoyproxy#42269)

Commit Message: HTTP2: change the default reset code from no error to
internal error
Additional Description:

This PR makes Envoy generate less NO_ERROR from the codec when there is
a stream reset to close
envoyproxy#36200.

https://httpwg.org/specs/rfc9113.html#RST_STREAM
https://httpwg.org/specs/rfc9113.html#ErrorCodes

Thanks so much for the great work from @botengyao in the
envoyproxy#40729

Risk Level: mid.
Testing: unit + integration
Docs Changes:
Release Notes:
Platform Specific Features:
[Optional Runtime guard:]
[Optional Fixes #Issue]
[Optional Fixes commit #PR or SHA]
[Optional Deprecated:]
[Optional [API
Considerations](https://github.com/envoyproxy/envoy/blob/main/api/review_checklist.md):]

---------

Signed-off-by: wbpcode <[email protected]>
Signed-off-by: code <[email protected]>
Signed-off-by: Gustavo <[email protected]>
grnmeira pushed a commit to grnmeira/envoy that referenced this pull request Mar 20, 2026
related to envoyproxy#42269

Commit Message:
Additional Description:
Risk Level:
Testing:
Docs Changes:
Release Notes:
Platform Specific Features:

---------

Signed-off-by: Boteng Yao <[email protected]>
Signed-off-by: Gustavo <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

HTTP2 locally-originated stream resets use the NO_ERROR code

4 participants