grpc / grpc-dart

The Dart language implementation of gRPC.
https://pub.dev/packages/grpc
Apache License 2.0
852 stars 267 forks source link

HTTP/2 error: Stream error: Stream was terminated by peer (errorCode: 1) when using Unix sockets on OSX #576

Closed denizt closed 2 years ago

denizt commented 2 years ago

All gRPC calls fail when using UNIX sockets on mullvad-daemon

grpc: 3.0.2

Repro steps

  1. Get the example project attached
  2. pub get
  3. Execute unix_client

Expected result: TunnelState indicating the state of the VPN

Actual result: HTTP/2 error: Stream error: Stream was terminated by peer (errorCode: 1)

Details

Might be related to https://github.com/grpc/grpc-dart/issues/572 The server is built with https://github.com/hyperium/tonic and works as expected for both rust and grpc-python

mullvad_daemon_test.zip

faern commented 2 years ago

The server also works as expected with a gprc-js client, as that's what the GUI frontend is using. https://github.com/mullvad/mullvadvpn-app/blob/dca39b225e54eecc2309bff371e7f6c5262f5203/gui/src/main/daemon-rpc.ts#L1

mraleph commented 2 years ago

mullvad_daemon_test.zip

Could you please put your reproduction into some github/gitlab repo and license it under some open-source license of your choice? We can't look at any code that does not have a clear license unfortunately.

denizt commented 2 years ago

Sure, added it to the examples in the fork https://github.com/denizt/grpc-dart/tree/mullvad-testcase/example

Same license as the repo, Apache-2.0

mraleph commented 2 years ago

I took a quick look. Enabling verbose logging on the server side reveals that it (rightfully so) does not like authority field which grpc-dart sends. You can work-around by doing ChannelCredentials.insecure(authority: 'localhost').

I will make PR which would make grpc-dart default to localhost authority when connecting over UDS.