On Sat, Apr 13, 2024 at 9:23 AM Debraj <[email protected]> wrote:

> I did not quite understand the statement - "*It will respond
> with Status.UNKNOWN and interceptors might get confused"* .
>
> Let's say I do not have the try - catch in the purge() method and I have
> a ServerInterceptor like below.
>

If you really want to throw and for it to be propagated, use
TransmitStatusRuntimeExceptionInterceptor
<https://grpc.github.io/grpc-java/javadoc/io/grpc/util/TransmitStatusRuntimeExceptionInterceptor.html>.
It has to be carefully placed in the interceptor chain to work well. But we
generally discourage using it because it can make understanding errors
difficult.

          handleException(ex);
>           throw ex;
>

This calls call.close() *and* throws an exception. That very well might be
racy. If you handle the exception (by calling close), don't re-throw the
exception. gRPC ignores the exception's contents and always uses UNKNOWN
when processing it.

If the HttpServer is not available then from gRPC2 server
Status.UNAVAILABLE error
> is thrown with some Metadata as shown below. But we are observing that
> sometimes the Metadata is not coming to gRPC1. It does not happen always.
>

If you get UNAVAILABLE without the Metadata you expect, then that was
probably a failure between gRPC1 → gRPC2. If the problem is caused by
throwing an exception, you'd see UNKNOWN instead. In either case, the
status description tells you a lot about what is going on, so if you want
us to tell you why something is happening, you need to give us the full
status.

-- 
You received this message because you are subscribed to the Google Groups 
"grpc.io" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/grpc-io/CA%2B4M1oPWRfK5M%2BUEWcUGFesedht%2B0UEg8EzDV0Vx5tSA7ww6hQ%40mail.gmail.com.

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

Reply via email to