If an exception is thrown in a StreamObserver, it will be caught in the
JumpToApplicationThreadServerStreamListener and cause the stream to be
closed. Eventually the exception will propagate back back to the
serializing executor contained in the Server, which will log the exception.
Server side deadlines are set before the ServerInterceptors are added.
These are normally derived from the deadline provided by the client. You
can add your own ServerInterceptor to add a deadline if you would like,
though.
On Wednesday, December 14, 2016 at 5:08:36 PM UTC-8, Eugene Strulyov wrote:
>
> Hi all,
>
> I am trying to use grpc for a new project. The service is in java and the
> client in python. I have questions about exception handling and timeouts.
>
> A grpc call seemed to get stuck. The client wasn't getting a response and
> the server didn't seem to do anything. This particular call uses client ->
> server streaming. Turned out that a RuntimeException was thrown in onNext()
> method and was not caught, so neither onError() nor onCompleted() ended up
> getting called. I changed the code to do the following:
>
> @Override
>
> public void onNext(...) {
>
> try {
>
> // do stuff
>
> } catch (Exception ex) {
>
> responseObserver.onError(ex);
>
> }
>
> }
>
>
> This fixed the problem, but it raised the following questions:
>
>
> 1. Do I really need to catch all exceptions and explicitly call onError()
> ? Uncaught exception does not abort the call?
>
>
> 2. I would expect the call to time out at some point. It would be really
> *really* undesirable to leave both the client and the server in a zombie
> state. The timeout does not seem to be happening.
>
>
> Please advise. Thanks.
>
>
> Eugene
>
>
>
--
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 post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/grpc-io.
To view this discussion on the web visit
https://groups.google.com/d/msgid/grpc-io/6913d30b-e9e7-4539-92a6-c4a90fecb7ba%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.