Bazel: Why bazel ignore http_proxy in environment??

Created on 31 Oct 2017  Â·  6Comments  Â·  Source: bazelbuild/bazel

Environment info

  • Operating System: Linux
uname -a
Linux ihlee 4.4.0-93-generic #116~14.04.1-Ubuntu SMP Mon Aug 14 16:07:05 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
  • Bazel version (output of bazel info release):
bazel version
WARNING: ignoring http_proxy in environment.
Build label: 0.5.4
Build target: bazel-out/local-fastbuild/bin/src/main/java/com/google/devtools/build/lib/bazel/BazelServer_deploy.jar
Build time: Fri Aug 25 10:00:00 2017 (1503655200)
Build timestamp: 1503655200
Build timestamp as int: 1503655200

I'm trying to build c++ source which contains tensorflow c++ API.
But It continues to fail when it try to download tar.gz file..
I think it is problem bazel ignore http_proxy in my linux environment...
How can I configure for my proxy when I use bazel??
or Does anybody help me out??

bazel run -c opt //tensorflow/cc/example:basic_mlp
WARNING: ignoring http_proxy in environment.
ERROR: /home/ihlee/anaconda3/envs/tensorflow/tensorflow/tensorflow/cc/example/BUILD:20:1: error loading package 'tensorflow/core': Encountered error while reading extension file 'protobuf.bzl': no such package '@protobuf//': java.io.IOException: Error downloading [http://mirror.bazel.build/github.com/google/protobuf/archive/0b059a3d8a8f8aa40dde7bea55edca4ec5dfea66.tar.gz] to /home/ihlee/.cache/bazel/_bazel_ihlee/b725cdeaf9f7daef51d029bc8126d503/external/protobuf/0b059a3d8a8f8aa40dde7bea55edca4ec5dfea66.tar.gz: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target and referenced by '//tensorflow/cc/example:basic_mlp'.
ERROR: Analysis of target '//tensorflow/cc/example:basic_mlp' failed; build aborted.
INFO: Elapsed time: 15.492s
ERROR: Build failed. Not running target.
P2 feature request

Most helpful comment

I run into similar problem and as mentioned here, changing from http(s)_proxy to HTTP(S)_PROXY helped.

All 6 comments

I am not immediately familiar with this feature.

However after some digging, according to @kchodorow in #7497 (comment), that proxy ignore message is for the Bazel client, not server (which is responsible for fetching the dependency).

This error seems to be related to a missing certificate instead:

sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target and referenced by '//tensorflow/cc/example:basic_mlp'.

And to fix this issue, @onurgu suggests that you can install the certificate by finding the cacert file and installing it using a browser. Perhaps this StackOverflow question can be of some help.

1) Where do I try to get certification from??(IP:port or URL:port)
--> I failed to get cacerts from github.com

$java InstallCert github.com
Loading KeyStore /usr/lib/jvm/jdk1.8.0_73/jre/lib/security/cacerts...
Opening connection to github.com:443...
Exception in thread "main" java.net.ConnectException: Connection timed out
        at java.net.PlainSocketImpl.socketConnect(Native Method)
        at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
        at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
        at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
        at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
        at java.net.Socket.connect(Socket.java:589)
        at sun.security.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:668)
        at sun.security.ssl.SSLSocketImpl.<init>(SSLSocketImpl.java:427)
        at sun.security.ssl.SSLSocketFactoryImpl.createSocket(SSLSocketFactoryImpl.java:88)
        at InstallCert.main(InstallCert.java:59)

2)Maybe.. this is easier way for me..
I can download bazel files(https://mirror.bazel.build/github.com/bazelbuild/rules_closure/archive/4af89ef1db659eb41f110df189b67d4cf14073e1.tar.gz) using wget command.
How can I use it when I build through bazel??

$bazel build  //tensorflow:libtensorflow_cc.so
WARNING: ignoring http_proxy in environment.
ERROR: error loading package '': Encountered error while reading extension file 'closure/defs.bzl': no such package '@io_bazel_rules_closure//closure': Error downloading [**https://mirror.bazel.build/github.com/bazelbuild/rules_closure/archive/4af89ef1db659eb41f110df189b67d4cf14073e1.tar.gz**, https://github.com/bazelbuild/rules_closure/archive/4af89ef1db659eb41f110df189b67d4cf14073e1.tar.gz] to /home/ihlee/.cache/bazel/_bazel_ihlee/082f5057b23825d747e9cd0fd8c2576f/external/io_bazel_rules_closure/4af89ef1db659eb41f110df189b67d4cf14073e1.tar.gz: All mirrors are down: [sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target]
ERROR: error loading package '': Encountered error while reading extension file 'closure/defs.bzl': no such package '@io_bazel_rules_closure//closure': Error downloading [https://mirror.bazel.build/github.com/bazelbuild/rules_closure/archive/4af89ef1db659eb41f110df189b67d4cf14073e1.tar.gz, https://github.com/bazelbuild/rules_closure/archive/4af89ef1db659eb41f110df189b67d4cf14073e1.tar.gz] to /home/ihlee/.cache/bazel/_bazel_ihlee/082f5057b23825d747e9cd0fd8c2576f/external/io_bazel_rules_closure/4af89ef1db659eb41f110df189b67d4cf14073e1.tar.gz: All mirrors are down: [sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target]
INFO: Elapsed time: 17.672s
FAILED: Build did NOT complete successfully (0 packages loaded)

I have a fix for this.

Scratch this - as @jin pointed out, the issue was never that Bazel ignored the proxy settings (the warning is just very misleading regarding that). This seems to be some issue with your local JDK missing certificates (although I'm not sure why it would check any certificates for an http:// URL?).

If this still happens, can you please send the output of bazel version and bazel info?

Closing for lack of additional information requested.

I run into similar problem and as mentioned here, changing from http(s)_proxy to HTTP(S)_PROXY helped.

I make HTTP_PROXY=http://:@:* in my .bashrc,why my bazel is not useful?

Was this page helpful?
0 / 5 - 0 ratings