Asynchronous RPC to a CompletionQueue that has been shutdown

33 views
Skip to first unread message

chh...@mesosphere.io

unread,
Jul 27, 2017, 3:04:36 PM7/27/17
to grpc.io
Hi all,

I was wondering that, if I post an asynchronous RPC request to a `CompletionQueue` that has been shutdown,
how can I tell from the return value for error handling?
I'm asking this because the asynchronous request and the `Shutdown()` call might happen
in two different threads, and since the `CompletionQueue` is thread-safe,
I'm thinking if I can avoid introducing my own synchronization variables and
rely on the result of the asynchronous call to avoid concurrency issues.

Thanks,
Chun-Hung

Yang Gao

unread,
Jul 28, 2017, 1:03:09 PM7/28/17
to grpc.io
It is not clear to me what you meant by post an async rpc request to a cq. However, the user of a cq needs to guarantee that no new event is added to the cq after a shutdown is called. As a result, you most likely need some of your own synchronization.
Thanks.

chh...@mesosphere.io

unread,
Jul 31, 2017, 5:04:19 PM7/31/17
to grpc.io
Thanks for your answer.
What I meant is calling the asynchronous API with a cq that has been shut down.
It seems to me that it would be nicer if the grpc library has some way to report such an error,
say maybe returning a null unique_ptr of async reader when an event is added after cq is shut down.
But for now I'll add my own synchronization to prevent this.

Best,
Chun-Hung
Reply all
Reply to author
Forward
0 new messages