aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorleonidlazarev <leonidlazarev@yandex-team.com>2025-02-10 19:20:25 +0300
committerleonidlazarev <leonidlazarev@yandex-team.com>2025-02-10 20:24:17 +0300
commit8f607c633bd02f251f25092b81be9e2748a4fa53 (patch)
treeacdc812ac708b499107ae79a62257be535943ca7
parent23dd312aa973b9071507e8e014f044e4fefcf0dc (diff)
downloadydb-8f607c633bd02f251f25092b81be9e2748a4fa53.tar.gz
feat grpc: Request body is malformed when using retryPolicy along with the gzip compression
Patch for issue 37742: Request body is malformed when using retryPolicy along with the gzip compression Tests: протестировано в тестинге commit_hash:d80d29f768bc26e1bcf6afa64b05cea476d4007d
-rw-r--r--contrib/libs/grpc/patches/pr37742_gzip.patch30
-rw-r--r--contrib/libs/grpc/src/core/ext/filters/client_channel/retry_filter.cc7
2 files changed, 36 insertions, 1 deletions
diff --git a/contrib/libs/grpc/patches/pr37742_gzip.patch b/contrib/libs/grpc/patches/pr37742_gzip.patch
new file mode 100644
index 0000000000..f2d41a3d74
--- /dev/null
+++ b/contrib/libs/grpc/patches/pr37742_gzip.patch
@@ -0,0 +1,30 @@
+--- a/src/core/ext/filters/client_channel/retry_filter.cc (index)
++++ b/src/core/ext/filters/client_channel/retry_filter.cc (working tree)
+@@ -462,6 +462,9 @@ class RetryFilter::CallData {
+ grpc_transport_stream_op_batch_payload batch_payload_;
+ // For send_initial_metadata.
+ grpc_metadata_batch send_initial_metadata_{calld_->arena_};
++
++ SliceBuffer send_message_;
++
+ // For send_trailing_metadata.
+ grpc_metadata_batch send_trailing_metadata_{calld_->arena_};
+ // For intercepting recv_initial_metadata.
+@@ -1911,6 +1914,7 @@ void RetryFilter::CallData::CallAttempt::BatchData::OnComplete(
+ }
+ if (batch_data->batch_.send_message) {
+ ++call_attempt->completed_send_message_count_;
++ call_attempt->send_message_.Clear();
+ }
+ if (batch_data->batch_.send_trailing_metadata) {
+ call_attempt->completed_send_trailing_metadata_ = true;
+@@ -1999,7 +2003,8 @@ void RetryFilter::CallData::CallAttempt::BatchData::
+ calld->send_messages_[call_attempt_->started_send_message_count_];
+ ++call_attempt_->started_send_message_count_;
+ batch_.send_message = true;
+- batch_.payload->send_message.send_message = cache.slices;
++ call_attempt_->send_message_ = cache.slices->Copy();
++ batch_.payload->send_message.send_message = &call_attempt_->send_message_;
+ batch_.payload->send_message.flags = cache.flags;
+ }
+
diff --git a/contrib/libs/grpc/src/core/ext/filters/client_channel/retry_filter.cc b/contrib/libs/grpc/src/core/ext/filters/client_channel/retry_filter.cc
index bc965c4731..e92398f4b2 100644
--- a/contrib/libs/grpc/src/core/ext/filters/client_channel/retry_filter.cc
+++ b/contrib/libs/grpc/src/core/ext/filters/client_channel/retry_filter.cc
@@ -462,6 +462,9 @@ class RetryFilter::CallData {
grpc_transport_stream_op_batch_payload batch_payload_;
// For send_initial_metadata.
grpc_metadata_batch send_initial_metadata_{calld_->arena_};
+
+ SliceBuffer send_message_;
+
// For send_trailing_metadata.
grpc_metadata_batch send_trailing_metadata_{calld_->arena_};
// For intercepting recv_initial_metadata.
@@ -1911,6 +1914,7 @@ void RetryFilter::CallData::CallAttempt::BatchData::OnComplete(
}
if (batch_data->batch_.send_message) {
++call_attempt->completed_send_message_count_;
+ call_attempt->send_message_.Clear();
}
if (batch_data->batch_.send_trailing_metadata) {
call_attempt->completed_send_trailing_metadata_ = true;
@@ -1999,7 +2003,8 @@ void RetryFilter::CallData::CallAttempt::BatchData::
calld->send_messages_[call_attempt_->started_send_message_count_];
++call_attempt_->started_send_message_count_;
batch_.send_message = true;
- batch_.payload->send_message.send_message = cache.slices;
+ call_attempt_->send_message_ = cache.slices->Copy();
+ batch_.payload->send_message.send_message = &call_attempt_->send_message_;
batch_.payload->send_message.flags = cache.flags;
}