From ca1b57c340f979fbd8acc2cf631b574555ad3e1e Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Wed, 30 Oct 2024 21:57:59 -0700 Subject: [PATCH] Add latent see annotations to more of grpc PiperOrigin-RevId: 691669259 --- src/core/BUILD | 1 + src/core/lib/surface/client_call.cc | 8 ++++++-- src/core/lib/surface/server_call.cc | 18 +++++++++++++----- src/core/lib/transport/promise_endpoint.h | 2 ++ src/core/server/server.cc | 1 + 5 files changed, 23 insertions(+), 7 deletions(-) diff --git a/src/core/BUILD b/src/core/BUILD index 32647489631..77a351d8bc5 100644 --- a/src/core/BUILD +++ b/src/core/BUILD @@ -8047,6 +8047,7 @@ grpc_cc_library( "grpc_promise_endpoint", "if", "inter_activity_pipe", + "latent_see", "loop", "map", "memory_quota", diff --git a/src/core/lib/surface/client_call.cc b/src/core/lib/surface/client_call.cc index 7f96a43b8aa..3b30be8a85d 100644 --- a/src/core/lib/surface/client_call.cc +++ b/src/core/lib/surface/client_call.cc @@ -192,7 +192,9 @@ void ClientCall::ScheduleCommittedBatch(Batch batch) { auto pending = std::make_unique(); pending->start_pending_batch = [this, batch = std::move(batch)]() mutable { - started_call_initiator_.SpawnInfallible("batch", std::move(batch)); + started_call_initiator_.SpawnInfallible( + "batch", + GRPC_LATENT_SEE_PROMISE("ClientCallBatch", std::move(batch))); }; while (true) { pending->next = reinterpret_cast(cur_state); @@ -212,7 +214,9 @@ void ClientCall::ScheduleCommittedBatch(Batch batch) { } } case kStarted: - started_call_initiator_.SpawnInfallible("batch", std::move(batch)); + started_call_initiator_.SpawnInfallible( + "batch", + GRPC_LATENT_SEE_PROMISE("ClientCallBatch", std::move(batch))); return; case kCancelled: return; diff --git a/src/core/lib/surface/server_call.cc b/src/core/lib/surface/server_call.cc index ed1d0bb8426..7b662f08855 100644 --- a/src/core/lib/surface/server_call.cc +++ b/src/core/lib/surface/server_call.cc @@ -50,6 +50,9 @@ #include "src/core/lib/transport/metadata_batch.h" #include "src/core/server/server_interface.h" #include "src/core/util/bitset.h" +#include "absl/log/check.h" +#include "absl/strings/string_view.h" +#include "third_party/grpc/src/core/util/latent_see.h" namespace grpc_core { @@ -193,13 +196,18 @@ void ServerCall::CommitBatch(const grpc_op* ops, size_t nops, void* notify_tag, }); }); call_handler_.SpawnInfallible( - "final-batch", InfallibleBatch(std::move(primary_ops), - std::move(recv_trailing_metadata), - is_notify_tag_closure, notify_tag, cq_)); + "final-batch", + GRPC_LATENT_SEE_PROMISE( + "ServerCallBatch", + InfallibleBatch(std::move(primary_ops), + std::move(recv_trailing_metadata), + is_notify_tag_closure, notify_tag, cq_))); } else { call_handler_.SpawnInfallible( - "batch", FallibleBatch(std::move(primary_ops), is_notify_tag_closure, - notify_tag, cq_)); + "batch", GRPC_LATENT_SEE_PROMISE( + "ServerCallBatch", + FallibleBatch(std::move(primary_ops), + is_notify_tag_closure, notify_tag, cq_))); } } diff --git a/src/core/lib/transport/promise_endpoint.h b/src/core/lib/transport/promise_endpoint.h index 02033d956a4..cfe748c6e30 100644 --- a/src/core/lib/transport/promise_endpoint.h +++ b/src/core/lib/transport/promise_endpoint.h @@ -70,6 +70,7 @@ class PromiseEndpoint { // `Write()` before the previous write finishes. Doing that results in // undefined behavior. auto Write(SliceBuffer data) { + GRPC_LATENT_SEE_PARENT_SCOPE("GRPC:Write"); // Start write and assert previous write finishes. auto prev = write_state_->state.exchange(WriteState::kWriting, std::memory_order_relaxed); @@ -132,6 +133,7 @@ class PromiseEndpoint { // `Read()` before the previous read finishes. Doing that results in // undefined behavior. auto Read(size_t num_bytes) { + GRPC_LATENT_SEE_PARENT_SCOPE("GRPC:Read"); // Assert previous read finishes. CHECK(!read_state_->complete.load(std::memory_order_relaxed)); // Should not have pending reads. diff --git a/src/core/server/server.cc b/src/core/server/server.cc index 70197c8626f..9f070136ecf 100644 --- a/src/core/server/server.cc +++ b/src/core/server/server.cc @@ -976,6 +976,7 @@ grpc_error_handle Server::SetupTransport( Transport* transport, grpc_pollset* accepting_pollset, const ChannelArgs& args, const RefCountedPtr& socket_node) { + GRPC_LATENT_SEE_INNER_SCOPE("Server::SetupTransport"); // Create channel. global_stats().IncrementServerChannelsCreated(); // Set up channelz node.