tikv / grpc-rs

The gRPC library for Rust built on C Core library and futures
Apache License 2.0
1.81k stars 253 forks source link

RpcFailure: 14-UNAVAILABLE failed to connect to all addresses, when executed behind corporate proxy server #556

Open maheshrayas opened 2 years ago

maheshrayas commented 2 years ago

Describe the bug When I run my code behind the corporate proxy server below is the error I get RpcFailure: 14-UNAVAILABLE failed to connect to all addresses.

Does the code automatically set the http proxy env variables ?

To Reproduce

  1. Connected to corporate VPN
  2. Set the ENV variables: http_proxy``https_proxy HTTP_PROXY HTTPS_PROXY, GOOGLE_APPLICATION_CREDENTIALS, GRPC_DEFAULT_SSL_ROOTS_FILE_PATH
  3. Fails to generate the Client

Expected behavior Successfully generate the Client

System information

BusyJay commented 2 years ago

Can you paste the log after enabling debug logs? Following is an example of doing so:

env GRPC_VERBOSITY=debug https_proxy=http://127.0.0.1:1234  cargo run
maheshrayas commented 2 years ago

HI @BusyJay, Thanks for replying. Below are the logs after setting the verbosity to debug


D0208 16:20:47.794876000 4354020864 lb_policy_registry.cc:42]          registering LB policy factory for "grpclb"
D0208 16:20:47.794895000 4354020864 lb_policy_registry.cc:42]          registering LB policy factory for "priority_experimental"
D0208 16:20:47.794906000 4354020864 lb_policy_registry.cc:42]          registering LB policy factory for "weighted_target_experimental"
D0208 16:20:47.794917000 4354020864 lb_policy_registry.cc:42]          registering LB policy factory for "pick_first"
D0208 16:20:47.794923000 4354020864 lb_policy_registry.cc:42]          registering LB policy factory for "round_robin"
D0208 16:20:47.794931000 4354020864 dns_resolver_ares.cc:499]          Using ares dns resolver
D0208 16:20:47.795046000 4354020864 certificate_provider_registry.cc:33] registering certificate provider factory for "file_watcher"
D0208 16:20:47.795060000 4354020864 lb_policy_registry.cc:42]          registering LB policy factory for "cds_experimental"
D0208 16:20:47.795071000 4354020864 lb_policy_registry.cc:42]          registering LB policy factory for "xds_cluster_impl_experimental"
D0208 16:20:47.795083000 4354020864 lb_policy_registry.cc:42]          registering LB policy factory for "xds_cluster_resolver_experimental"
D0208 16:20:47.795092000 4354020864 lb_policy_registry.cc:42]          registering LB policy factory for "xds_cluster_manager_experimental"
I0208 16:20:47.797360000 4354020864 check_gcp_environment_no_op.cc:28] ALTS: Platforms other than Linux and Windows are not supported
I0208 16:20:47.799762000 123145487593472 http_connect_handshaker.cc:332] Connecting to server container.googleapis.com via HTTP proxy ipv4:127.0.0.1:3128
I0208 16:20:47.867741000 123145487593472 subchannel.cc:1012]           Connect failed: {"created":"@1644297647.867577000","description":"HTTP proxy returned response code 502","file":"/Users/rayasm1/.cargo/registry/src/github.com-1ecc6299db9ec823/grpcio-sys-0.9.1+1.38.0/grpc/src/core/ext/filters/client_channel/http_connect_handshaker.cc","file_line":252}
I0208 16:20:47.867870000 123145487593472 subchannel.cc:957]            Subchannel 0x7f81917084e0: Retry in 930 milliseconds
RpcFailure: 14-UNAVAILABLE failed to connect to all addresses```
BusyJay commented 2 years ago

You can also enabling tracer tcp to find out more information and compare what's the difference after using a proxy.

An example would be:

env GRPC_VERBOSITY=debug GRPC_TRACE=tcp

Note the debug information may contains sensitive information and not be appropriate to paste here. From the informations given above, proxy should work as expected, though there may be some parameters not available for remote to process the requests or perhaps the remote just deny proxy.