Hi there,

Thanks for q and observation. A ServerContext object can only be used once. 
The example uses "new CallData" for each request, and the ServerContext is 
a member of the CallData.

Regards,

Vijay

On Monday, January 14, 2019 at 2:14:00 PM UTC-8, Alistair Lowe wrote:
>
> I finally found the small print about not using the same server context 
> between rpcs.
>
> Is anyone able to confirm if this refers to simultaneous usage or if it's 
> a one-time use only and needs recreating for each rpc? (I note that the 
> example at 
> https://github.com/grpc/grpc/blob/master/examples/cpp/helloworld/greeter_async_server.cc
>  
> appears to share a single context).
>
> Many thanks
>
> On Sunday, January 13, 2019 at 9:54:24 PM UTC, Alistair Lowe wrote:
>>
>> Hi guys,
>>
>> I've just written an async gRPC++ server implementation, I'm able to 
>> successfully receive and finish one request, however the subsequent request 
>> fails as it's retrieved via ServerCompletionQueue::AsyncNext() within 
>> ServerContext::BeginCompletionOp() when asserting !compleition_op_ on line 
>> 269. Sequence of events are as follows:
>>
>> 1. Register to receive multiple requests for various rpc calls.
>> 2. Send rpc request from client app.
>> 3. Receive and finish rpc request.
>> 4. Register to receive the request again.
>> 5. Send same rpc request from client app.
>> 6. Assert fails during call to ServerCompletionQueue::AsyncNext() as the 
>> request arrives server side.
>>
>> Terminal Output:
>> E0113 21:37:39.692948234  130281 server_context.cc:269]      assertion 
>> failed: !completion_op_
>>
>> Stack Trace from call to AsyncNext:
>> __GI_raise(int sig) 
>> (/build/glibc-OTsEL5/glibc-2.27/sysdeps/unix/sysv/linux/raise.c:51)
>> __GI_abort() (/build/glibc-OTsEL5/glibc-2.27/stdlib/abort.c:79)
>> grpc::ServerContext::BeginCompletionOp(grpc::internal::Call*, bool) 
>> (Unknown Source:0)
>> grpc::ServerInterface::BaseAsyncRequest::FinalizeResult(void**, bool*) 
>> (Unknown Source:0)
>> grpc::ServerInterface::RegisteredAsyncRequest::FinalizeResult(grpc::ServerInterface::RegisteredAsyncRequest
>>  
>> * const this, void ** tag, bool * status) 
>> (/usr/local/include/grpcpp/impl/codegen/server_interface.h:194)
>> grpc::ServerInterface::PayloadAsyncRequest<OpenIoTServer::CompileVMRequest>::FinalizeResult(grpc::ServerInterface::PayloadAsyncRequest<OpenIoTServer::CompileVMRequest>
>>  
>> * const this, void ** tag, bool * status) 
>> (/usr/local/include/grpcpp/impl/codegen/server_interface.h:274)
>> grpc::CompletionQueue::AsyncNextInternal(void**, bool*, gpr_timespec) 
>> (Unknown Source:0)
>> grpc::CompletionQueue::AsyncNext<std::chrono::time_point<std::chrono::_V2::system_clock,
>>  
>> std::chrono::duration<long, std::ratio<1l, 1000000000l> > > 
>> >(grpc::CompletionQueue * const this, void ** tag, bool * ok, const 
>> std::chrono::time_point<std::chrono::_V2::system_clock, 
>> std::chrono::duration<long, std::ratio<1, 1000000000> > > & deadline) 
>> (/usr/local/include/grpcpp/impl/codegen/completion_queue.h:190)
>>
>> Is anyone able to offer any thoughts as to why compleition_op_ may not be 
>> getting cleared?
>>
>> Many thanks
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"grpc.io" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/grpc-io.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/grpc-io/0fe49deb-b1c6-460b-82ca-f89727f93fec%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to