I run into an issue that `BlockingResponseStream.hasNext` occasionally blocks forever while sending response for a streaming RPC.
GRPC server is still able to serve requests after client hangs. No exception is found in server log, and server does call "responseObserver.onCompleted()" after each GRPC.
It only happens to me when streaming millions of messages.
I haven't found any reliable way to reproduce this issue, but following code and comment in `ClientCalls.java` caught my attention:
try {
// Will block here indefinitely waiting for content. RPC timeouts defend against permanent
// hangs here as the call will become closed.
last = waitForNext();
} catch (InterruptedException ie) {
Thread.currentThread().interrupt();
throw Status.CANCELLED.withCause(ie).asRuntimeException();
}
I am not vary familiar with GRPC codebase. Could someone tell me when is this call going to block and which thread usually unblocks it? What could cause the call being blocked forever?
It seems GRPC does not timeout by default. Should I specify RPC timeout?
What's the best practice for streaming millions of messages?