diff --git a/src/core/client_channel/retry_filter_legacy_call_data.cc b/src/core/client_channel/retry_filter_legacy_call_data.cc index 7e3abc4a5a8..eba9999f37b 100644 --- a/src/core/client_channel/retry_filter_legacy_call_data.cc +++ b/src/core/client_channel/retry_filter_legacy_call_data.cc @@ -1268,6 +1268,7 @@ void RetryFilter::LegacyCallData::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; @@ -1348,7 +1349,8 @@ void RetryFilter::LegacyCallData::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/src/core/client_channel/retry_filter_legacy_call_data.h b/src/core/client_channel/retry_filter_legacy_call_data.h index b121a8735bc..4569d865b1c 100644 --- a/src/core/client_channel/retry_filter_legacy_call_data.h +++ b/src/core/client_channel/retry_filter_legacy_call_data.h @@ -263,6 +263,8 @@ class RetryFilter::LegacyCallData final { grpc_transport_stream_op_batch_payload batch_payload_; // For send_initial_metadata. grpc_metadata_batch send_initial_metadata_; + // For send_message. + SliceBuffer send_message_; // For send_trailing_metadata. grpc_metadata_batch send_trailing_metadata_; // For intercepting recv_initial_metadata.