From 20023faa2e871e5e326cb01eb1c61eb915ae696f Mon Sep 17 00:00:00 2001 From: Mehrdad Afshari Date: Tue, 23 May 2023 15:16:58 -0700 Subject: [PATCH] [API] Document gotcha in AsyncNotifyWhenDone behavior (#33208) As the [issue](https://github.com/grpc/grpc/issues/10136) documents, the behavior of AsyncNotifyWhenDone is documented as: "The comment on `AsyncNotifyWhenDone` states "Has to be called before the rpc starts" but it seems that if the request tag is returned with ok=false (i.e. because the CQ is shutting down) then the async done tag is never received. Instead, I expect the async done tag to be received regardless of whether or not an incoming call request was successfully received." The TODO item is marked closed as stale, and it seems unlikely this will be resolved, without breaking existing users whose code is written under the assumption that the tag is not seen if the call never starts, so it may be time to documented the idiosyncratic corner case and make it the expected behavior. --- include/grpcpp/server_context.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/grpcpp/server_context.h b/include/grpcpp/server_context.h index e5f29a5a6fe..925316762fc 100644 --- a/include/grpcpp/server_context.h +++ b/include/grpcpp/server_context.h @@ -305,8 +305,8 @@ class ServerContextBase { /// Async only. Has to be called before the rpc starts. /// Returns the tag in completion queue when the rpc finishes. /// IsCancelled() can then be called to check whether the rpc was cancelled. - /// TODO(vjpai): Fix this so that the tag is returned even if the call never - /// starts (https://github.com/grpc/grpc/issues/10136). + /// Note: the tag will only be returned if call starts. + /// If the call never starts, this tag will not be returned. void AsyncNotifyWhenDone(void* tag) { has_notify_when_done_tag_ = true; async_notify_when_done_tag_ = tag;