-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[ext_proc] let ext_proc filter follow the grpc spec, wait for trailers before continue the filter chain upon last main stream end_stream=true event. #37088
Comments
This issue has been automatically marked as stale because it has not had activity in the last 30 days. It will be closed in the next 7 days unless it is tagged "help wanted" or "no stalebot" or other activity occurs. Thank you for your contributions. |
hey @tyxia/ @yanavlasov could you put a |
Hi, @stevenzzzz , If a HTTP request does not have trailers, i.e, if it only contains body, then after ext_proc filter receives the last chunk body response from the ext_proc server (end_of_stream = true in this case), it will terminate the external processing and call continueProcessing(). That's what's the ext_proc filter is designed today. I am a little bit confusing why ext_proc filter need to wait for a trailers coming back. |
BTW, the gRPC channel between Envoy and the ext_proc server provides the transportation for the actual HTTP request/response in the main stream. The ext_proc filter state machine ties to the content of the mainstream HTTP request/response. It does not depend on the gRPC channel status, i.e, whether the gRPC channel had sent the trailers or not, for its state transitions. |
Thanks Yanjun.
Noteworthy the trailers mentioned is not for the "upstream reqest", but the "side-stream" grpc request's trailers. |
I am not sure I agree. See Router::Filter::onUpstreamTrailers for example: https://github.com/envoyproxy/envoy/blob/main/source/common/router/router.cc#L1743-L1759 |
Title: ext_proc side grpc stream should follow grpc spec to wait for trailers to end a session.
Description:
In Grpc, the trailers carries the grpc-status header terminates a rpc stream. see https://github.com/grpc/grpc/blob/master/doc/PROTOCOL-HTTP2.md#responses for the spec and https://carlmastrangelo.com/blog/why-does-grpc-insist-on-trailers for why.
Our current grpc flow in ext_proc filter ignores the trailers by closeStream and resetStream all together, the later resetStream call would signal the remote server a CANCEL, while clean the sidestream and ignore any possible trailers that might have been sent by ext_proc server.
Instead, for the last de/encode{Headers,data} call, ext_proc filter should fire a half-close (closeStream), and wait until the trailers come back, then call continueProcessing().
In PR #37083 we moved one step towards this goal: split half-close from reset(), but we would like to move the half-close earlier to the filter callbacks, before onDestroy gets called.
Noteworthy that there are special case in GRPC: Headers only response carries grpc-status in response headers, in which case we should proactively close the side stream as well.
The text was updated successfully, but these errors were encountered: