Assertion failed: !completion_op_ in server_context.cc:269 grpc++ 1.17

30 views
Skip to first unread message

Alistair Lowe

unread,
Jan 13, 2019, 4:54:24 PM1/13/19
to grpc.io
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

Alistair Lowe

unread,
Jan 14, 2019, 5:14:00 PM1/14/19
to grpc.io
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

Vijay Pai

unread,
Jan 14, 2019, 5:24:52 PM1/14/19
to grpc.io
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
Reply all
Reply to author
Forward
0 new messages