Reputation: 569
I noticed that a blocking gPRC call might be blocked for a long, long time, if not for ever.
I checked and found the following page:https://grpc.io/docs/guides/concepts.html#deadlines
However, the page does not tell the default deadline/timeout value for Java. So, I am wondering if there is a default java value.
I probably have to set a deadline value for all the calls, if not. Which is inconvenient...
Upvotes: 6
Views: 6680
Reputation: 473
Just like @Eric Anderson said, there's no default deadline. But, it's highly recommended to set one for each RPC in the client and service provider should also specify the longest deadline they support as mentioned in the blog: https://grpc.io/blog/deadlines
In general, when you don’t set a deadline, resources will be held for all in-flight requests, and all requests can potentially reach the maximum timeout. This puts the service at risk of running out of resources, like memory, which would increase the latency of the service, or could crash the entire process in the worst case.
To avoid this, services should specify the longest default deadline they technically support, and clients should wait until the response is no longer useful to them. For the service this can be as simple as providing a comment in the .proto file. For the client this involves setting useful deadlines.
Upvotes: 0
Reputation: 57
It is equivalent to "infinity" according to this issue https://github.com/grpc/grpc-java/issues/1495
Upvotes: 1
Reputation: 26414
There is no default deadline, in gRPC for any language. If there are network failures and keepalive is enabled on client-side, the call will eventually fail. But if the server takes an unbounded amount of time, then the client may wait an unbounded amount of time.
Upvotes: 8