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

grpc-web: Gracefully close a streaming connection #206

Closed
ligustah opened this issue Jun 26, 2019 · 3 comments
Closed

grpc-web: Gracefully close a streaming connection #206

ligustah opened this issue Jun 26, 2019 · 3 comments
Labels

Comments

@ligustah
Copy link

Calling cancel() on the ResponseStream returned by a streaming RPC throws an exception.

version: 2.0.0+1

Repro steps

Don't have separate code for this right now, but could prepare something if required.

  1. Call a server-side streaming RPC
  2. Receive messages
  3. Call cancel() on the ResponseStream

Expected result: The connection is closed is closed and I can handle any possible exceptions.

Actual result: The code will throw two exceptions, only one of which I can catch.

Details

I can see why adding an error to the stream when calling cancel() might be useful, but somewhere in the code it tries to add another error to one of the internal streams after that one was closed, which triggers the bad state exception seen below.

EXCEPTION: Bad state: Cannot add event after closing
STACKTRACE: 
dart:sdk_internal                                                                                addError
package:grpc/src/client/packages/grpc/src/client/call.dart 305:16                                [_onRequestError]
package:grpc/packages/grpc/src/client/transport/xhr_transport.dart 61:13                         <fn>

...

EXCEPTION: gRPC Error (1, Cancelled by client.)
STACKTRACE: 
package:grpc/src/client/packages/grpc/src/client/call.dart 324:18                                cancel
package:grpc/src/client/packages/grpc/src/client/common.dart 85:34                               cancel

Potentially related: #111

@softkot
Copy link

softkot commented Sep 23, 2020

I am confirming this annoying bug in 2.3.0

@mraleph
Copy link
Member

mraleph commented Sep 28, 2020

Duplicate of #67 wrong classification. This issue is about grpc-web

@mraleph mraleph marked this as a duplicate of #67 Sep 28, 2020
@mraleph mraleph closed this as completed Sep 28, 2020
@mraleph mraleph reopened this Sep 28, 2020
@mraleph mraleph marked this as not a duplicate of #67 Sep 28, 2020
@aragonet
Copy link

The same is happening here on web with grpc version 2.8.0

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

No branches or pull requests

5 participants