grpc-java
grpc-java copied to clipboard
stub.withWaitForReady().withDeadline is masking the underlying exceptions
try {
stub.withWaitForReady().withDeadline().hello();
} catch(StatusRuntimeException e) {
// always receiving DEADLINE_EXCEEDED as status code if server is unavailable or client certs are invalid
}
There is no way to distinguish the underlying cause of failure , say if the failure is due to SSLHanshake or server genuinely not being available.
As an alternative, without using withWaitForReady() we are receiving UNAVAILABLE code in StatusRuntimeException which wraps the underlying cause say for example the SSLHandshake exception. Looking at the UNAVAILABLE code how can we safely take a call if we to reattempt connection, as we do not want to reattempt the connection in SSLException scenarios?
Drive-by comment: What needs to happen here is we enhance DelayedStream/PendingStream to remember the last pick failure and then add it during appendTimeoutInsight() if there is no real stream. We've been aware of this shortcoming, but most people aren't using waitForReady(). Then you'd get better error information without doing anything in particular (as long as DEADLINE_EXCEEDED still triggers). #6569 might be related.