diff --git a/python/ray/tests/test_basic.py b/python/ray/tests/test_basic.py index a1e7f6d77..a4c765566 100644 --- a/python/ray/tests/test_basic.py +++ b/python/ray/tests/test_basic.py @@ -7,6 +7,7 @@ import collections import io import json import logging +import os import re import string import sys @@ -24,6 +25,19 @@ import ray.test_utils logger = logging.getLogger(__name__) +# https://github.com/ray-project/ray/issues/6662 +def test_ignore_http_proxy(shutdown_only): + ray.init(num_cpus=1) + os.environ["http_proxy"] = "http://example.com" + os.environ["https_proxy"] = "http://example.com" + + @ray.remote + def f(): + return 1 + + assert ray.get(f.remote()) == 1 + + def test_simple_serialization(ray_start_regular): primitive_objects = [ # Various primitive types. diff --git a/src/ray/rpc/grpc_client.h b/src/ray/rpc/grpc_client.h index 2e1687b66..1999ef7e3 100644 --- a/src/ray/rpc/grpc_client.h +++ b/src/ray/rpc/grpc_client.h @@ -38,8 +38,13 @@ class GrpcClient { public: GrpcClient(const std::string &address, const int port, ClientCallManager &call_manager) : client_call_manager_(call_manager) { - std::shared_ptr channel = grpc::CreateChannel( - address + ":" + std::to_string(port), grpc::InsecureChannelCredentials()); + grpc::ChannelArguments argument; + // Disable http proxy since it disrupts local connections. TODO(ekl) we should make + // this configurable, or selectively set it for known local connections only. + argument.SetInt(GRPC_ARG_ENABLE_HTTP_PROXY, 0); + std::shared_ptr channel = + grpc::CreateCustomChannel(address + ":" + std::to_string(port), + grpc::InsecureChannelCredentials(), argument); stub_ = GrpcService::NewStub(channel); } @@ -50,6 +55,7 @@ class GrpcClient { quota.SetMaxThreads(num_threads); grpc::ChannelArguments argument; argument.SetResourceQuota(quota); + argument.SetInt(GRPC_ARG_ENABLE_HTTP_PROXY, 0); std::shared_ptr channel = grpc::CreateCustomChannel(address + ":" + std::to_string(port), grpc::InsecureChannelCredentials(), argument); @@ -85,4 +91,4 @@ class GrpcClient { } // namespace rpc } // namespace ray -#endif \ No newline at end of file +#endif