1
votes

In my application (c++) I have a service exposed as:

grpc foo(stream Request) returns (Reply) { }

The issue is that when the server goes down (CTRL-C) the stream on the client side keeps going indeed the

grpc::ClientWriter::Write

doesn't return false. I can confirm that using netstat I don't see any connection between the client and the server (apart a TIME_WAIT one that after a while goes away) and the client keeps calling that Write without errors.

Is there a way to see if the underlying connection is still up instead to rely on the Write return value ? I use grpc version 1.12

update

I discovered that the underlying channel goes in status IDLE but still the ClientWriter::Write doesn't report the error, I don't know if this is intended. During the streaming I'm trying now to reestablish a connection with the server every time the channel status is not GRPC_CHANNEL_READY

1
You could overlay the protocol with some kind of are-you-there message that you send on regular intervals?Some programmer dude
I can but that is an "hack"Gaetano Mendola
I discovered that the underlying channel goes in status IDLE but still the ClientWriter::Write doesn't report the error, I don't know if this is intended. During the streaming I'm trying now to reestablish a connection with the server.Gaetano Mendola

1 Answers

0
votes

This could happen in a few scenarios but the most common element is a connection issue. We have KEEPALIVE support in gRPC to tackle exactly this issue. For C++, please refer to https://github.com/grpc/grpc/blob/master/doc/keepalive.md on how to set this up. Essentially, endpoints would send pings at certain intervals and expect a reply within a certain timeframe.