Repository navigation
gRPC-Web: Fix failing HTTP/2 requests on some browsers due to empty trailers - #12178
Conversation
Signed-off-by: Dhi Aurrahman <[email protected]>
Signed-off-by: Dhi Aurrahman <[email protected]>
Signed-off-by: Dhi Aurrahman <[email protected]>
Signed-off-by: Dhi Aurrahman <[email protected]>
Signed-off-by: Dhi Aurrahman <[email protected]>
Signed-off-by: Dhi Aurrahman <[email protected]>
Signed-off-by: Dhi Aurrahman <[email protected]>
Signed-off-by: Dhi Aurrahman <[email protected]>
Signed-off-by: Dhi Aurrahman <[email protected]>
Signed-off-by: Dhi Aurrahman <[email protected]>
Signed-off-by: Dhi Aurrahman <[email protected]>
|
Before working on this further. I would like to validate the direction of this PR. To give a scoped context: gPRC-Web Filter, mandated by spec to embed the trailers in the body, hence it clears the trailers after copying it to the body. Since we always encode empty trailers, this introduces an issue for Safari (as reported here https://bugs.webkit.org/show_bug.cgi?id=210108 ) and other browsers (i.e. IE11 pre-Chromium era #10514) when the downstream is HTTP/2. @lizan @alyssawilk could you give your advice here? I'm not sure if HCM level is OK for this since this, I think, can be done in our H2 codec as well (from my limited knowledge of understanding code seems like the example from nghttp2 is also skipping submitting trailers when it is empty: https://github.com/nghttp2/nghttp2/blob/a3a034813b86f7413b745ce9e416bc9f8e7fd053/src/shrpx_http2_downstream_connection.cc#L206). Or probably there is a better solution for this. Thank you 🙏🏽. |
Signed-off-by: Dhi Aurrahman <[email protected]>
Signed-off-by: Dhi Aurrahman <[email protected]>
Signed-off-by: Dhi Aurrahman <[email protected]>
mattklein123
left a comment
There was a problem hiding this comment.
Thanks LGTM modulo small comment and sorting out clang-tidy which seems like it almost about to be fixed.
/wait
| void ConnectionImpl::StreamImpl::submitTrailers(const HeaderMap& trailers) { | ||
| const bool skip_encoding_empty_trailers = | ||
| trailers.empty() && parent_.skip_encoding_empty_trailers_; | ||
| if (skip_encoding_empty_trailers) { |
There was a problem hiding this comment.
can you ASSERT(local_end_stream_) above this line? I think it should always be true?
Signed-off-by: Dhi Aurrahman <[email protected]>
Signed-off-by: Dhi Aurrahman <[email protected]>
|
/retest |
|
🔨 rebuilding |
|
Thanks to @lizan clang-tidy issue for codec_impl.h is fixed. |
|
LGTM can you merge main? /wait |
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
…railers (envoyproxy#12178) This adds `envoy.reloadable_features.skip_encoding_empty_trailers` runtime feature flag (enabled by default) to skip encoding empty trailers in H2 codec. This behavior can be reverted temporarily by setting runtime feature `envoy.reloadable_features.skip_encoding_empty_trailers` to false. Before this commit, seeing empty trailers of gRPC-Web filter response, codec submits: ``` [ 5.036] recv DATA frame <length=28, flags=0x00, stream_id=13> [ 5.040] recv DATA frame <length=52, flags=0x00, stream_id=13> [ 5.053] recv HEADERS frame <length=0, flags=0x05, stream_id=13> ; END_STREAM | END_HEADERS ``` After: ``` [ 5.036] recv DATA frame <length=28, flags=0x00, stream_id=13> [ 5.040] recv DATA frame <length=52, flags=0x00, stream_id=13> [ 5.052] recv DATA frame <length=0, flags=0x01, stream_id=13> ; END_STREAM ``` Risk Level: Low Testing: Unit, integration tests. Docs Changes: N/A. Release Notes: Added Fixes envoyproxy#10514 Signed-off-by: Dhi Aurrahman <[email protected]>
…railers (envoyproxy#12178) This adds `envoy.reloadable_features.skip_encoding_empty_trailers` runtime feature flag (enabled by default) to skip encoding empty trailers in H2 codec. This behavior can be reverted temporarily by setting runtime feature `envoy.reloadable_features.skip_encoding_empty_trailers` to false. Before this commit, seeing empty trailers of gRPC-Web filter response, codec submits: ``` [ 5.036] recv DATA frame <length=28, flags=0x00, stream_id=13> [ 5.040] recv DATA frame <length=52, flags=0x00, stream_id=13> [ 5.053] recv HEADERS frame <length=0, flags=0x05, stream_id=13> ; END_STREAM | END_HEADERS ``` After: ``` [ 5.036] recv DATA frame <length=28, flags=0x00, stream_id=13> [ 5.040] recv DATA frame <length=52, flags=0x00, stream_id=13> [ 5.052] recv DATA frame <length=0, flags=0x01, stream_id=13> ; END_STREAM ``` Risk Level: Low Testing: Unit, integration tests. Docs Changes: N/A. Release Notes: Added Fixes envoyproxy#10514 Signed-off-by: Dhi Aurrahman <[email protected]> Signed-off-by: chaoqinli <[email protected]>
Commit Message: This adds
envoy.reloadable_features.skip_encoding_empty_trailersruntime feature flag (enabled by default) to skip encoding empty trailers in H2 codec. This behavior can be reverted temporarily by setting runtime featureenvoy.reloadable_features.skip_encoding_empty_trailersto false.Before this commit, seeing empty trailers of gRPC-Web filter response:
After:
Signed-off-by: Dhi Aurrahman [email protected]
Additional Description: I have a reproducer here: https://github.com/dio/grpc-web-hello, and this patch is confirmed to work: #10514 (comment). For WebKit, the issue is logged here: https://bugs.webkit.org/show_bug.cgi?id=210108. The issue is also observed in Internet Explorer 11 and Edge on various patch versions of Windows 10 (pre-Chromium).
Risk Level: Low
Testing: Updated
Docs Changes: N/A.
Release Notes: Added
Fixes #10514