[logs] Remove unsafe use of grpc_transport_stream_op_batch_string (#34187)

Batch completions can run after the Server promise call finishes and
deallocates the server trailing metadata. Remove the use of
grpc_transport_stream_op_batch_string so that such batch completions
dont end up de-referencing an already free'ed grpc_metadata_batch.
pull/33289/head
Vignesh Babu 1 year ago committed by GitHub
parent 041b734218
commit 1083044792
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 8
      src/core/lib/transport/batch_builder.cc

@ -35,11 +35,9 @@ void BatchBuilder::PendingCompletion::CompletionCallback(
auto* pc = static_cast<PendingCompletion*>(self);
auto* party = pc->batch->party.get();
if (grpc_call_trace.enabled()) {
gpr_log(
GPR_DEBUG, "%sFinish batch-component %s for %s: status=%s",
pc->batch->DebugPrefix(party).c_str(), std::string(pc->name()).c_str(),
grpc_transport_stream_op_batch_string(&pc->batch->batch, false).c_str(),
error.ToString().c_str());
gpr_log(GPR_DEBUG, "%sFinish batch-component %s: status=%s",
pc->batch->DebugPrefix(party).c_str(),
std::string(pc->name()).c_str(), error.ToString().c_str());
}
party->Spawn(
"batch-completion",

Loading…
Cancel
Save