On Mon, Jun 6, 2016 at 2:59 PM, Scott Devoid <[email protected]> wrote:
> Hi,
>
> I have a few questions about how gRPC cancellation works in Golang:
>
> First, what are the conditions under which a request could be
> cancelled? I can think of a two but let me know if I am missing some
> or incorrect:
>
> - client cancels context.Context passed into request.
> - TCP socket closes after a timeout?
> - HTTP/2 client/server sends RST_STREAM for...reasons?
>
> The 1st and 3rd are the reasons. the 2nd won't cause a cancellation error.
> Second, if the client cancels the context, is the server notified
> about this (assuming no loss of connectivity)? Can I select on
> req.Context().Done() and perform some clean-up work after the fact or
> does the request handler immediately return?
>
Yes, cancellation will propagate to the server if it is needed.
>
> Third, in one of our bidirectional gRPC methods[1] we see a 'stream
> error: code = 1 desc = "context cancelled"' event. However the client
> passed in a context.Background() to the request so as far as I can
> tell this cancellation has to be happening in grpc internals some
> place. Does anyone know what is going on here?
>
Not sure, perhaps the server initiated the cancellation.
>
> Thanks!
>
> ~ Scott Devoid
>
> [1] rpc Foo(stream Req) returns (stream Resp) {}
>
> --
> 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].
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/grpc-io/CAJrQjSvM3BZv9kBYJCdVCNGxxqzsSDCWGWKe%3DeoY43tUQ%3DV78g%
> 40mail.gmail.com.
> For more options, visit https://groups.google.com/d/optout.
>
--
Thanks,
-Qi
--
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].
To view this discussion on the web visit
https://groups.google.com/d/msgid/grpc-io/CAFnDmdqTHGxXxAUTDUT_ZBjLRcLd85vSXZ34%3Dne8i%2BGk8fzBZw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.