Skip to content

grpc-web: Fix 503 handling for gRPC Web text#14516

Merged
dio merged 59 commits intoenvoyproxy:mainfrom
dio:grpc-web-text
Jan 28, 2021
Merged

grpc-web: Fix 503 handling for gRPC Web text#14516
dio merged 59 commits intoenvoyproxy:mainfrom
dio:grpc-web-text

Conversation

@dio
Copy link
Member

@dio dio commented Dec 24, 2020

Commit Message: This fixes the 503 handling for gRPC Web requests with application/grpc-web-text content-type. Previously, when the upstream cannot be contacted (since local reset or connection reset), the gRPC Web filter always expects gRPC response from the local reply handler. This fix is guarded by envoy.reloadable_features.grpc_web_fix_non_proto_encoded_response_handling feature flag.

Additional Description: #13831 (comment).
Risk Level: Low
Testing: Integration test, and manual test
Docs Changes: N/A
Release Notes: Added, since adding envoy.reloadable_features.grpc_web_fix_non_proto_encoded_response_handling feature flag.
Platform-Specific Features: N/A

Fixes #13831

Signed-off-by: Dhi Aurrahman dio@rockybars.com

dio and others added 3 commits December 24, 2020 01:15
This fixes the 503 handling for gRPC Web requests with text
content-type. Previously, when the upstream cannot be contacted (local
reset or connection reset), gRPC Web filter always expect gRPC response
from local reply handler.

Signed-off-by: Dhi Aurrahman <dio@rockybars.com>
Signed-off-by: Dhi Aurrahman <dio@rockybars.com>
@dio dio marked this pull request as ready for review December 29, 2020 05:44
@dio dio requested a review from lizan as a code owner December 29, 2020 05:44
Copy link
Contributor

@snowp snowp left a comment

Choose a reason for hiding this comment

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

Thanks, some comments to get this started

@snowp snowp added the waiting label Dec 29, 2020
dio added 2 commits December 29, 2020 21:50
Signed-off-by: Dhi Aurrahman <dio@tetrate.io>
dio added 3 commits December 30, 2020 00:38
Signed-off-by: Dhi Aurrahman <dio@rockybars.com>
Signed-off-by: Dhi Aurrahman <dio@rockybars.com>
Signed-off-by: Dhi Aurrahman <dio@rockybars.com>
qiwzhang
qiwzhang previously approved these changes Dec 31, 2020
@dio dio requested a review from snowp January 5, 2021 04:27
@alyssawilk alyssawilk self-assigned this Jan 6, 2021
Copy link
Contributor

@alyssawilk alyssawilk left a comment

Choose a reason for hiding this comment

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

Thanks for tackling this! A few thoughts

Signed-off-by: Dhi Aurrahman <dio@rockybars.com>
dio added 3 commits January 6, 2021 23:51
Signed-off-by: Dhi Aurrahman <dio@rockybars.com>
Signed-off-by: Dhi Aurrahman <dio@rockybars.com>
Signed-off-by: Dhi Aurrahman <dio@rockybars.com>
dio added 6 commits January 20, 2021 23:49
Signed-off-by: Dhi Aurrahman <dio@rockybars.com>
Signed-off-by: Dhi Aurrahman <dio@rockybars.com>
Signed-off-by: Dhi Aurrahman <dio@rockybars.com>
Signed-off-by: Dhi Aurrahman <dio@rockybars.com>
Signed-off-by: Dhi Aurrahman <dio@rockybars.com>
Signed-off-by: Dhi Aurrahman <dio@rockybars.com>
@dio
Copy link
Member Author

dio commented Jan 21, 2021

The error message from CI: ##[error]System.IO.IOException: No space left on device

Copy link
Contributor

@alyssawilk alyssawilk left a comment

Choose a reason for hiding this comment

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

Almost there. @lizan and @snowp can you two do a pass as well?

return Runtime::runtimeFeatureEnabled(
"envoy.reloadable_features.grpc_web_fix_non_proto_encoded_response_handling") &&
!Grpc::Common::isGrpcResponseHeaders(headers, end_stream) &&
!(Http::Utility::getResponseStatus(headers) == enumToInt(Http::Code::OK) &&
Copy link
Contributor

Choose a reason for hiding this comment

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

mind commenting why we do not convert if the response code is OK?

Copy link
Member Author

@dio dio Jan 21, 2021

Choose a reason for hiding this comment

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

Sure. Commented. Hope it clarifies, but if you see it is wrong, please let me know. Thanks!

dio added 5 commits January 21, 2021 21:25
Signed-off-by: Dhi Aurrahman <dio@rockybars.com>
Signed-off-by: Dhi Aurrahman <dio@rockybars.com>
Signed-off-by: Dhi Aurrahman <dio@rockybars.com>
Signed-off-by: Dhi Aurrahman <dio@rockybars.com>
lizan
lizan previously approved these changes Jan 23, 2021
alyssawilk
alyssawilk previously approved these changes Jan 25, 2021
@dio
Copy link
Member Author

dio commented Jan 26, 2021

@snowp please let me know if you need me to introduce more changes to this PR. Thank you!

Copy link
Contributor

@snowp snowp left a comment

Choose a reason for hiding this comment

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

Thanks for working on this! Just some questions/suggestions


void GrpcWebFilter::mergeAndLimitNonProtoEncodedResponseData(Buffer::OwnedImpl& output,
Buffer::Instance* last_data) {
const auto* encoding_buffer = encoder_callbacks_->encodingBuffer();
Copy link
Contributor

Choose a reason for hiding this comment

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

Instead of doing all this gymnastics to create a new buffer, can you just call addEncodedData and then read from the buffer?

Copy link
Member Author

Choose a reason for hiding this comment

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

Do you mean addEncodedData for the last_data?

Copy link
Member Author

Choose a reason for hiding this comment

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

Updated.

Signed-off-by: Dhi Aurrahman <dio@rockybars.com>
@dio dio dismissed stale reviews from alyssawilk and lizan via c8d0bac January 26, 2021 21:10
dio added 2 commits January 26, 2021 23:15
Signed-off-by: Dhi Aurrahman <dio@rockybars.com>
Signed-off-by: Dhi Aurrahman <dio@rockybars.com>
@dio
Copy link
Member Author

dio commented Jan 27, 2021

/retest

@repokitteh-read-only
Copy link

Retrying Azure Pipelines:
Retried failed jobs in: envoy-presubmit

🐱

Caused by: a #14516 (comment) was created by @dio.

see: more, trace.

Copy link
Contributor

@snowp snowp left a comment

Choose a reason for hiding this comment

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

Thanks this LGTM!

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.

grpc-web RPC blocks forever if gRPC server terminates

5 participants