Search code examples
grpcgrpc-c++

How long is it allowed to block a grpc thread


I have implemented a server-streaming server based on grpc. The grpc::ServerWriteReactor class is used as stream writers. When a remote procedure is called by a client, a reactor is created. The data for is retrieved from a thread-safe queue: in the OnWriteDone method, the next Response is retrieved and passed to the StartWrite method.

The queue is blocking. When there is no data in it, the reading thread (in my case it is the grpc library thread) blocks until data arrives in the queue.

Are there any restrictions on how long a grpc thread can be blocked? Is there some kind of liveness probe inside grpc that, seeing that the thread is blocked, will take some action?


Solution

  • There are no restrictions on the thread usage. gRPC has several threads in the pool and will grow the pool if necessary.