From a6f224e4a1fe8376d7dfc019c8c37074a4fd3de4 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Tue, 22 Mar 2022 20:45:06 -0700 Subject: [PATCH] debug --- src/core/lib/channel/promise_based_filter.cc | 16 ++++++++++++++++ src/core/lib/surface/call.cc | 13 ++++++++----- src/core/lib/surface/call.h | 8 +++----- 3 files changed, 27 insertions(+), 10 deletions(-) diff --git a/src/core/lib/channel/promise_based_filter.cc b/src/core/lib/channel/promise_based_filter.cc index 480d085344d..576a2230c06 100644 --- a/src/core/lib/channel/promise_based_filter.cc +++ b/src/core/lib/channel/promise_based_filter.cc @@ -113,6 +113,15 @@ class ClientCallData::PollContext { PollContext& operator=(const PollContext&) = delete; void Run() { + gpr_log( + GPR_ERROR, + "%p PollContext::Run: send_initial_state=%d, recv_trailing_state=%d, " + "recv_initial_state=%d", + self_, self_->send_initial_state_, self_->recv_trailing_state_, + self_->recv_initial_metadata_ == nullptr + ? -1 + : self_->recv_initial_metadata_->state); + GPR_ASSERT(have_scoped_activity_); repoll_ = false; if (self_->server_initial_metadata_latch() != nullptr) { @@ -359,6 +368,13 @@ void ClientCallData::StartBatch(grpc_transport_stream_op_batch* batch) { // Fake out the activity based context. ScopedContext context(this); + gpr_log( + GPR_ERROR, + "%p StartBatch: send_initial_state=%d, recv_trailing_state=%d, " + "recv_initial_state=%d", + this, send_initial_state_, recv_trailing_state_, + recv_initial_metadata_ == nullptr ? -1 : recv_initial_metadata_->state); + // If this is a cancel stream, cancel anything we have pending and propagate // the cancellation. if (batch->cancel_stream) { diff --git a/src/core/lib/surface/call.cc b/src/core/lib/surface/call.cc index 771651257ca..bd7dbaea017 100644 --- a/src/core/lib/surface/call.cc +++ b/src/core/lib/surface/call.cc @@ -1821,17 +1821,20 @@ grpc_call_stack* grpc_call_get_call_stack(grpc_call* call) { grpc_call_error grpc_call_start_batch(grpc_call* call, const grpc_op* ops, size_t nops, void* tag, void* reserved) { - GRPC_API_TRACE( - "grpc_call_start_batch(call=%p, ops=%p, nops=%lu, tag=%p, " - "reserved=%p)", - 5, (call, ops, (unsigned long)nops, tag, reserved)); + gpr_log(GPR_ERROR, + "grpc_call_start_batch(call=%p, ops=%p, nops=%lu, tag=%p, " + "reserved=%p)", + call, ops, (unsigned long)nops, tag, reserved); if (reserved != nullptr) { + abort(); return GRPC_CALL_ERROR; } else { grpc_core::ApplicationCallbackExecCtx callback_exec_ctx; grpc_core::ExecCtx exec_ctx; - return grpc_core::Call::FromC(call)->StartBatch(ops, nops, tag, false); + auto e = grpc_core::Call::FromC(call)->StartBatch(ops, nops, tag, false); + gpr_log(GPR_ERROR, "grpc_call_start_batch(call=%p) --> %d", call, e); + return e; } } diff --git a/src/core/lib/surface/call.h b/src/core/lib/surface/call.h index 3f9c5ad7471..b6328fa2884 100644 --- a/src/core/lib/surface/call.h +++ b/src/core/lib/surface/call.h @@ -101,11 +101,9 @@ void grpc_call_context_set(grpc_call* call, grpc_context_index elem, /* Get a context pointer. */ void* grpc_call_context_get(grpc_call* call, grpc_context_index elem); -#define GRPC_CALL_LOG_BATCH(sev, ops, nops) \ - do { \ - if (GRPC_TRACE_FLAG_ENABLED(grpc_api_trace)) { \ - grpc_call_log_batch(sev, ops, nops); \ - } \ +#define GRPC_CALL_LOG_BATCH(sev, ops, nops) \ + do { \ + grpc_call_log_batch(sev, ops, nops); \ } while (0) uint8_t grpc_call_is_client(grpc_call* call);