Repository navigation
upstream: correctly handle h2 and h3 stream resets with no error - #44749
Conversation
Fixed a bug where an upstream HTTP/2 or HTTP/3 ``RST_STREAM(NO_ERROR)`` received after a complete response would cause the response to be discarded and replaced with an error. This behavior is common with some gRPC clients and servers, but is often intermittent. Fixes envoyproxy#38206 Signed-off-by: Greg Greenway <[email protected]>
|
The specific way I saw this happen is when the client for whatever reason does not send end_stream in the same frame as the end of the data or trailers, in a grpc request. The default golang grpc server code reads the entire protobuf payload and calls the registered handler. If the response is fully sent before the client end_stream arrives, golang grpc also sends RST_STREAM(NO_ERROR), which is allowed by the RFC. Envoy sees a reset, and does not finish sending any buffered response to the client. This PR fixes that behavior, so that envoy does not treat that situation as an error and cancel the response. |
Signed-off-by: Greg Greenway <[email protected]>
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request fixes a bug where an upstream HTTP/2 or HTTP/3 RST_STREAM(NO_ERROR) received after a complete response would cause the response to be discarded and replaced with an error. It introduces a new StreamResetReason::RemoteResetNoError to handle these non-error resets gracefully, ensuring that complete responses—including those with buffered trailers—are preserved and forwarded to the client. This behavior is controlled by the envoy.reloadable_features.http_preserve_rst_no_error runtime flag. Feedback was provided regarding a potential request hang in the router filter if a RemoteResetNoError occurs before the downstream response has been initiated.
Signed-off-by: Greg Greenway <[email protected]>
|
/retest |
| response would cause the response to be discarded and replaced with an error. This behavior is | ||
| common with some gRPC clients and servers, but is often intermittent. This behavior can be | ||
| temporarily reverted by setting the runtime flag | ||
| ``envoy.reloadable_features.http_preserve_rst_no_error`` to ``false``. |
There was a problem hiding this comment.
consider documenting that these RSTs will not trigger:
upstream_rq_rx_resetinc, UpstreamRemoteReset won't be set for these cases.
As it could be confusing to see the RST on the wire but no RST here
There was a problem hiding this comment.
That's a good point. Do you agree that we shouldn't set those? I think most/all people see that counter and flag is indications of an error, and this is not an error, so my thinking was to not do that. But it is a reset, and those things are all named "reset".
There was a problem hiding this comment.
Do you agree that we shouldn't set those? I think most/all people see that counter and flag is indications of an error, and this is not an error, so my thinking was to not do that.
Yes I almost exclusively have used it for this and I suspect a lot of other folks might as well given we've had this non-compliance with the spec for a long time.
I don't like the idea of having this not leaving a signal though. WDYT of having a upstream_rq_no_error_rx_reset stat for the upstream metric as a middle ground?
There was a problem hiding this comment.
Added a metric and documented all this
Signed-off-by: Greg Greenway <[email protected]>
Signed-off-by: Greg Greenway <[email protected]>
Signed-off-by: Greg Greenway <[email protected]>
Signed-off-by: Greg Greenway <[email protected]>
Signed-off-by: Greg Greenway <[email protected]>
Wrong PR This reverts commit ca5dc2a. Signed-off-by: Greg Greenway <[email protected]>
Signed-off-by: Greg Greenway <[email protected]>
|
/retest |
…oyproxy#44749) Fixed a bug where an upstream HTTP/2 or HTTP/3 ``RST_STREAM(NO_ERROR)`` received after a complete response would cause the response to be discarded and replaced with an error. This behavior is common with some gRPC clients and servers, but is often intermittent. Runtime guard: envoy.reloadable_features.http_preserve_rst_no_error Fixes envoyproxy#38206 Signed-off-by: Greg Greenway <[email protected]> Signed-off-by: Alireza <[email protected]>
Fixed a bug where an upstream HTTP/2 or HTTP/3
RST_STREAM(NO_ERROR)received after a complete response would cause the response to be discarded and replaced with an error. This behavior is common with some gRPC clients and servers, but is often intermittent.Claude code helped write PR
Risk Level: High
Testing: added new tests
Docs Changes: not needed
Release Notes: added
Runtime guard: envoy.reloadable_features.http_preserve_rst_no_error
Fixes #38206