Answering my own question.... I finally figured this out, I was on gRPC
release-0_15_1, switching to v1.0.x completely removed the problem. Hope
this useful for others.
John
On Friday, August 5, 2016 at 4:27:11 PM UTC-4, John Coffey wrote:
>
> I have a grpc c++ client & server working together. Things work well
> unless the server encounters a condition (when mpFlag is false) where it
> cannot return a protobuf response and instead it wants to return
> a grpc::StatusCode::UNAVAILABLE. The protobuf and server side code are
> shown below: When the mpFlag is false (and therefore the response is not
> filled in) the server console indicates:
>
> Server listening on 0.0.0.0:50051
> E0805 16:19:29.345000000 37328 chttp2_transport.c:1810] close_transport:
> {"creat
> ed":"@1470428369.345000000","description":"Failed parsing
> HTTP/2","file":"c:\mai
>
> n\extlibs\grpc\src\core\ext\transport\chttp2\transport\chttp2_transport.c","file
> _line":1726,"referenced_errors":[{"created":"@1470428369.345000000","description":"End
>
> of TCP
> stream","file":"c:\main\extlibs\grpc\src\core\lib\iomgr\tcp_windows.c","file_line":179}]}
>
> and the client console displays:
>
> E0805 15:05:07.514000000 4924 chttp2_transport.c:1810] close_transport:
> {"created":"@1470423907.514000000","description":"End of TCP
> stream","file":"c:\main\extlibs\gr\src\core\lib\iomgr\tcp_windows.c","file_line":179}
> message not available
> 421 Service not available
>
> This clearly shows that the client and server are communicating the
> grpc::StatusCode::UNAVAILABLE, however I do not want the extra
> tcp_windows.c crap to appear.
>
> My question is, how should I handle cases where an rpc method needs to
> return an error code instead of filling in the response message buffer. Do
> I always need to fill the response buffer details in? Also on the client
> side do I need to do anything special to close the channel?
>
> message OpSupportResponse {
> RXMessageType message_type = 1;
> string datetime = 20;
> }
>
> service CAService {
> // rpc method to retrieve current OpSupportMessage
> rpc GetOpSupportMessage (google.protobuf.Empty) returns
> (OpSupportResponse) {}
> }
>
> grpc::Status
> CADaemon::GetOpSupportMessage(
> ServerContext* context,
> const::google::protobuf::Empty* request,
> ca::OpSupportResponse* response)
> {
> if (mpOpSupportMessage) {
>
> response->set_message_type(ca::RXMessageType::OPERATIONAL_SUPPORT);
> response->set_datetime(value);
> return grpc::Status::OK;
> } else { // still waiting for the message
> // return grpc::Status::OK;
> return grpc::Status(grpc::StatusCode::UNAVAILABLE,
> "message not available");
> }
> }
>
>
--
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].
To view this discussion on the web visit
https://groups.google.com/d/msgid/grpc-io/e77495b6-c3e3-4cfc-b797-6869672f8a97%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.