grpc-go client disconnect in 60 seconds

Maxim Dounin mdounin at mdounin.ru
Tue Nov 10 13:41:50 UTC 2020


Hello!

On Tue, Nov 10, 2020 at 07:56:36AM -0500, aagrawal wrote:

> Hi ,
> I am using grpc-go client  for grpc subscription, and in every 60 seconds
> after subscription , it is disconnecting.
> I run nginx in debug mode, and found following logs where i see that "408"
> error  happened , because "client_body_timeout is default value 60 seconds."

[...]

> I tried increasing this client_body_timeout directive to 360 seconds, i see
> that grpc-go client  disconnect in 360 seconds.
> Same issue was not observed when i run grpc-java client or grpc-python
> client .
> 
> Can you please help me to know why this issue may happen ?

As long as your gRPC call uses client-to-server streaming, from 
HTTP point of view it essentially sends the request body in a 
small chunks.  As long as no data are sent for a long time, the 
client body timeout will occur.  This is what you seems to 
observe in your tests.

Similarly, grpc_read_timeout might occur for server-to-client 
streaming if no data are sent for a long time.

To fix this, make sure that at least some data are sent in gRPC 
streams periodically, and configure timeouts to something larger 
than the period in question.  Alternatively, consider avoiding 
gRPC streams and/or make sure streams are properly closed when 
they are no longer needed.

-- 
Maxim Dounin
http://mdounin.ru/


More information about the nginx mailing list