Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Server-side stream doesn't get cancelled #660

Open
LowderPlay opened this issue Aug 17, 2023 · 3 comments
Open

Server-side stream doesn't get cancelled #660

LowderPlay opened this issue Aug 17, 2023 · 3 comments

Comments

@LowderPlay
Copy link

I am creating server-side stream from Flutter client to Rust server (using tonic). When I'm gracefully stopping the server, it cancels all in-progress streams. However, grpc-dart client doesn't stop the streaming call when canceled from the server, thus making the server hang during shutdown.

This is not server implementation's fault. I verified that the stream gets cancelled by making the streaming call from Postman.

grpc-dart version: 3.2.3

Repro steps

  1. Create a server with server-side streaming RPC.
  2. Connect to the server and invoke this RPC.
  3. Stop the server (or cancel the stream from the server).
  4. Observe that grpc-dart client doesn't notice the cancellation and the server hangs.

Expected result: When the call is cancelled on the server, stream should close on the client side.

Actual result: Stream doesn't close when the call is cancelled from the server.

@mosuem
Copy link
Contributor

mosuem commented Aug 21, 2023

I am unsure if this is unexpected behavior - stopping the server just sends a GO_AWAY, see grpc/grpc-java#8770 (comment).

@LowderPlay
Copy link
Author

That makes sense. But I haven't found any way to detect that the server sent GO_AWAY. How could I subscribe for these events?

@mosuem
Copy link
Contributor

mosuem commented Aug 29, 2023

This is a low-level HTTP2 event, which is not exposed in the package. The recommendation in the comment above is to wait for some amount before force-shutting down. shutdownNow is not implemented here, but I would be happy to review a PR for this feature.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants