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

Unable to download dependencies #1979

Closed
maheshps1 opened this issue Oct 24, 2016 · 26 comments
Closed

Unable to download dependencies #1979

maheshps1 opened this issue Oct 24, 2016 · 26 comments
Assignees

Comments

@maheshps1
Copy link

I could not resolve below issue. This is I am compiling polyglot from Virtual Machine where proxy is set.

No issue when I compiled in my laptop with public network.

root@BLR1000015302:/polyglot# bazel build src/main/java/me/dinowernli/grpc/polyglot
Unhandled exception thrown during build; message: Unrecoverable error while evaluating node 'REPOSITORY_DIRECTORY:@protoc_osx_x86_64' (requested by nodes 'REPOSITORY:@protoc_osx_x86_64')
INFO: Elapsed time: 12.518s
java.lang.RuntimeException: Unrecoverable error while evaluating node 'REPOSITORY_DIRECTORY:@protoc_osx_x86_64' (requested by nodes 'REPOSITORY:@protoc_osx_x86_64')
at com.google.devtools.build.skyframe.ParallelEvaluator$Evaluate.run(ParallelEvaluator.java:447)
at com.google.devtools.build.lib.concurrent.AbstractQueueVisitor$WrappedRunnable.run(AbstractQueueVisitor.java:496)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.NullPointerException
at com.sun.security.ntlm.Client.type3(Client.java:161)
at sun.net.www.protocol.http.ntlm.NTLMAuthentication.buildType3Msg(NTLMAuthentication.java:241)
at sun.net.www.protocol.http.ntlm.NTLMAuthentication.setHeaders(NTLMAuthentication.java:216)
at sun.net.www.protocol.http.HttpURLConnection.doTunneling(HttpURLConnection.java:2096)
at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:183)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.connect(HttpsURLConnectionImpl.java:153)
at com.google.devtools.build.lib.bazel.repository.downloader.HttpConnection.createAndConnectViaHttp(HttpConnection.java:144)
at com.google.devtools.build.lib.bazel.repository.downloader.HttpConnection.createAndConnect(HttpConnection.java:92)
at com.google.devtools.build.lib.bazel.repository.downloader.HttpDownloader.download(HttpDownloader.java:149)
at com.google.devtools.build.lib.bazel.repository.downloader.HttpDownloader.download(HttpDownloader.java:92)
at com.google.devtools.build.lib.bazel.repository.HttpArchiveFunction.fetch(HttpArchiveFunction.java:66)
at com.google.devtools.build.lib.rules.repository.RepositoryDelegatorFunction.compute(RepositoryDelegatorFunction.java:155)
at com.google.devtools.build.skyframe.ParallelEvaluator$Evaluate.run(ParallelEvaluator.java:388)
... 4 more
java.lang.RuntimeException: Unrecoverable error while evaluating node 'REPOSITORY_DIRECTORY:@protoc_osx_x86_64' (requested by nodes 'REPOSITORY:@protoc_osx_x86_64')
at com.google.devtools.build.skyframe.ParallelEvaluator$Evaluate.run(ParallelEvaluator.java:447)
at com.google.devtools.build.lib.concurrent.AbstractQueueVisitor$WrappedRunnable.run(AbstractQueueVisitor.java:496)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.NullPointerException
at com.sun.security.ntlm.Client.type3(Client.java:161)
at sun.net.www.protocol.http.ntlm.NTLMAuthentication.buildType3Msg(NTLMAuthentication.java:241)
at sun.net.www.protocol.http.ntlm.NTLMAuthentication.setHeaders(NTLMAuthentication.java:216)
at sun.net.www.protocol.http.HttpURLConnection.doTunneling(HttpURLConnection.java:2096)
at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:183)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.connect(HttpsURLConnectionImpl.java:153)
at com.google.devtools.build.lib.bazel.repository.downloader.HttpConnection.createAndConnectViaHttp(HttpConnection.java:144)
at com.google.devtools.build.lib.bazel.repository.downloader.HttpConnection.createAndConnect(HttpConnection.java:92)
at com.google.devtools.build.lib.bazel.repository.downloader.HttpDownloader.download(HttpDownloader.java:149)
at com.google.devtools.build.lib.bazel.repository.downloader.HttpDownloader.download(HttpDownloader.java:92)
at com.google.devtools.build.lib.bazel.repository.HttpArchiveFunction.fetch(HttpArchiveFunction.java:66)
at com.google.devtools.build.lib.rules.repository.RepositoryDelegatorFunction.compute(RepositoryDelegatorFunction.java:155)
at com.google.devtools.build.skyframe.ParallelEvaluator$Evaluate.run(ParallelEvaluator.java:388)
... 4 more
root@BLR1000015302:
/polyglot#

Regards
-Mahesh

@katre
Copy link
Member

katre commented Oct 24, 2016

It looks like your proxy is expecting the service to respond to NTLM authentication, which we can't do. Can you change the proxy configuration to not require authentication, or use a local proxy which handles the authentication directly?

@maheshps1
Copy link
Author

sslverify I made false during proxy configuration. And I configured squid tool to allow all IP. But still same error.
While debugging I have seen, bazel tells unable to download, but if I use wget also unable to download for the same site, but even if I pass --no-certificate to wget then wget able to download. I think, somewhere this certificate exchange causes issue. Could not understand how to come out from this issue.

@maheshps1
Copy link
Author

I cannot disable authentication in local proxy as I discussed with admin team. Is there any other solution?

@katre
Copy link
Member

katre commented Oct 25, 2016

It seems Bazel doesn't have support for the proxy authentication you are using. Can you let us know
a) What is the name of the proxy software
b) What is the configured authentication method
c) Can other Java programs successfully authenticate to this proxy and download data over HTTP/S?

Thanks

@maheshps1
Copy link
Author

maheshps1 commented Oct 26, 2016

(a) used only local proxy now: configured in /etc/environment and /etc/apt/apt.conf
(b)
root@BLR1000015302:~/polyglot# cat /etc/environment
HTTP_PROXY="http://username:[email protected]:8080"
HTTPS_PROXY="https://username:[email protected]:8080"
FTP_PROXY="ftp://username:[email protected]:8080"
HTTP_SSLVERIFY=false
NO_PROXY="localhost,127.0.0.1,localaddress,.localdomain.com"

root@BLR1000015302:~/polyglot# cat /etc/apt/apt.conf
Acquire::http::proxy "http://username:[email protected]:8080";
Acquire::ftp::proxy "ftp://username:[email protected]:8080";
Acquire::https::proxy "https://username:[email protected]:8080";
(c) yes, grpc-java tool is working fine.
Note: for security reason not mentioned here the username, password and proxy name.

@maheshps1
Copy link
Author

Is it possible to download dependencies in some other machine and copy those dependencies to local machine to build polyglot?? I tried this, but still it is trying to download dependencies in local machine. How to over come from this?

@katre
Copy link
Member

katre commented Nov 29, 2016

Where are you installing the dependencies?

Have you looked at the "--experimental_repository_cache" flag? You can use that on your local version to cache downloaded artifacts in a single per-user location, then copy that cache to the remote machine and use the same flag so that it will be used there. The cache defaults to a location in your home directory, but by passing a value with the flag (ie, "--experimental_repository_cache=/path/to/cache") you can choose the directory to use.

@maheshps1
Copy link
Author

root@BLR1000015302:~/polyglot_temp# bazel build src/main/java/me/dinowernli/grpc/polyglot --experimental_repository_cache=/root/backup
Unrecognized option: --experimental_repository_cache=/root/backup

Is it correct command to build by using --experimental_repository_cache ??
Normally I used
root@BLR1000015302:/polyglot_temp# bazel build src/main/java/me/dinowernli/grpc/polyglot
ERROR: /root/polyglot_temp/third_party/protobuf/BUILD:13:1: no such package '@protoc_osx_x86_64//file': Error downloading from https://repo1.maven.org/maven2/com/google/protobuf/protoc/3.0.0-beta-3/protoc-3.0.0-beta-3-osx-x86_64.exe to /root/.cache/bazel/_bazel_root/5592dc4abbf4e732d4b7252f2ae4e980/external/protoc_osx_x86_64: Error downloading https://repo1.maven.org/maven2/com/google/protobuf/protoc/3.0.0-beta-3/protoc-3.0.0-beta-3-osx-x86_64.exe to /root/.cache/bazel/_bazel_root/5592dc4abbf4e732d4b7252f2ae4e980/external/protoc_osx_x86_64/protoc-3.0.0-beta-3-osx-x86_64.exe: Proxy address https://s00370346:OSPFospf is not a valid URL and referenced by '//third_party/protobuf:protoc_rule'.
ERROR: Analysis of target '//src/main/java/me/dinowernli/grpc/polyglot:polyglot' failed; build aborted.
INFO: Elapsed time: 2.423s
root@BLR1000015302:
/polyglot_temp#

Above are the dependency downloading files what I had mentioned.

@maheshps1
Copy link
Author

Hi katre,
Any input on this (above)?

@katre
Copy link
Member

katre commented Dec 2, 2016

That is the correct flag. What version of Bazel are you using? The flag was added recently, make sure you are using the latest release.

@maheshps1
Copy link
Author

maheshps1 commented Dec 5, 2016

I tried to install bazel-0.4.1-installer-linux-x86_64.sh now, but getting error
root@BLR1000015302:/opt# chmod +x bazel-0.4.1-installer-linux-x86_64.sh
root@BLR1000015302:/opt# ./bazel-0.4.1-installer-linux-x86_64.sh
...
Uncompressing..error [./bazel-0.4.0-installer-linux-x86_64.sh]: missing 1509 bytes in zipfile
(attempting to process anyway)
file #1: bad zipfile offset (local header sig): 5466
(attempting to re-compensate)
error: invalid compressed data to inflate /usr/local/lib/bazel/bin/bazel-real
I am using ubuntu OS
root@BLR1000015302:/opt# uname -a
Linux BLR1000015302 3.13.0-24-generic #47-Ubuntu SMP Fri May 2 23:30:00 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
root@BLR1000015302:/opt#

@damienmg
Copy link
Contributor

damienmg commented Dec 5, 2016 via email

@maheshps1
Copy link
Author

root@BLR1000015302:/opt# sha256sum bazel-0.4.1-installer-linux-x86_64.sh
11452bafd9735d79d2a1fdae4b865944d10d544ec4d7b90b7d5a8d63aecf6758 bazel-0.4.1-installer-linux-x86_64.sh
root@BLR1000015302:/opt#

@damienmg
Copy link
Contributor

damienmg commented Dec 5, 2016

186f22ea776fba7dd5931241700f60974a681e90eb5831d40257baac9a58e436 is the correct shasum (see on https://github.com/bazelbuild/bazel/releases/0.4.1) Can you try to redownload the artifact.

@maheshps1
Copy link
Author

I tried many times, but same issue. I wanted to know whether bazel-0.4.1-installer-linux-x86_64.sh is works
for Ubuntu OS ?

@maheshps1
Copy link
Author

Now I am able to install bazel latest installer. Now the question is how to use the flag experimental_repository_cache.
In my case, I have two systems (PC), one system has internet connection and another system has not internet connection. Finally I want to build my polyglot in my PC where there is no internet connection.
[1] System with Internet connection:
~/polyglot_temp# bazel clean --expunge
~/polyglot_temp# bazel build src/main/java/me/dinowernli/grpc/polyglot --experimental_repository_cache=/root/backup

tar cvf backup.tar.gz /root/backup

[2] System without internet connection
Transfer backup.tar.gz
~/polyglot_temp# bazel build src/main/java/me/dinowernli/grpc/polyglot --experimental_repository_cache=/root/backup

Please let me know, is it correct procedure?

@katre
Copy link
Member

katre commented Dec 6, 2016

That looks correct, please try it and let us know how it goes.

@maheshps1
Copy link
Author

maheshps1 commented Dec 7, 2016

Build is failed. It is trying to connect internet to download artifact com.google.protobuf:protobuf-java-util:jar. Error: "Connect to repo1.maven.org:443 timed out". For me, it should not connect internet to download, but it has to fetch all required artifacts from /root/poly_backup. Did I miss anything?

root@BLR1000015302:/polyglot# ls /root/poly_backup
content_addressable
root@BLR1000015302:
/polyglot# bazel build src/main/java/me/dinowernli/grpc/polyglot --experimental_repository_cache=/root/poly_backup
ERROR: /root/polyglot/third_party/protobuf/BUILD:3:1: no such package '@protobuf_java_util_artifact//jar': Failed to fetch Maven dependency: Could not transfer artifact com.google.protobuf:protobuf-java-util:jar:3.0.0-beta-3 from/to protobuf_java_util_artifact (https://repo1.maven.org/maven2/): Connect to repo1.maven.org:443 timed out and referenced by '//third_party/protobuf:protobuf'.
ERROR: Analysis of target '//src/main/java/me/dinowernli/grpc/polyglot:polyglot' failed; build aborted.
INFO: Elapsed time: 10.324s
root@BLR1000015302:~/polyglot#

@katre
Copy link
Member

katre commented Dec 7, 2016

Hmm, I'm not sure why it's still trying to download that. Did you make sure the @protobuf_java_util_artifact//jar dependency is in the cache you transferred?

@maheshps1
Copy link
Author

It is not present in downloaded cache.
root@BLR1000015302:/poly_backup# find . -name "protobuf_java_util_artifact"
root@BLR1000015302:
/poly_backup# find . -name "protobuf_java_util_artifact.*"
root@BLR1000015302:/poly_backup#
root@BLR1000015302:
/poly_backup/content_addressable/sha256# ls
306ea54a8c84874c880edeb454d92b4c8eed6f60affb1dfb0047532c62754253
...
4c16cd65e63a92f11f8a24c26a8b418ea6312484d341f66e94d4b5aa27e6e57b
root@BLR1000015302:~/poly_backup/content_addressable/sha256#
The downloaded cache only contains content_addressable/sha256 folder structure.

@katre
Copy link
Member

katre commented Dec 8, 2016

Can you share your WORKSPACE file with the maven_jar rules? I'd like to try and reproduce this.

@maheshps1
Copy link
Author

root@BLR1000015302:~/polyglot# cat WORKSPACE

http_file(
name = "gen_java_grpc_linux_x86_64",
url = "https://repo1.maven.org/maven2/io/grpc/protoc-gen-grpc-java/1.0.0/protoc-gen-grpc-java-1.0.0-linux-x86_64.exe",
sha256 = "4c16cd65e63a92f11f8a24c26a8b418ea6312484d341f66e94d4b5aa27e6e57b",
)

http_file(
name = "gen_java_grpc_osx_x86_64",
url = "https://repo1.maven.org/maven2/io/grpc/protoc-gen-grpc-java/1.0.0/protoc-gen-grpc-java-1.0.0-osx-x86_64.exe",
sha256 = "306ea54a8c84874c880edeb454d92b4c8eed6f60affb1dfb0047532c62754253",
)

http_file(
name = "protoc_osx_x86_64",
url = "https://repo1.maven.org/maven2/com/google/protobuf/protoc/3.0.0-beta-3/protoc-3.0.0-beta-3-osx-x86_64.exe",
sha256 = "3e197d491ba3e798bbe93b1b41f451ba1a15a731eb4da347e29b132bfbd814bc",
)

http_file(
name = "protoc_linux_x86_64",
url = "http://search.maven.org/remotecontent?filepath=com/google/protobuf/protoc/3.0.0-beta-3/protoc-3.0.0-beta-3-linux-x86_64.exe",
sha256 = "3d93855585bf8e8b152f6cec494f2d62932d4afa34c646bf1f73f7a09425e04c",
)

http_file(
name = "tcnative_boringssl_static_uberjar",
url = "http://search.maven.org/remotecontent?filepath=io/netty/netty-tcnative-boringssl-static/1.1.33.Fork19/netty-tcnative-boringssl-static-1.1.33.Fork19.jar",
sha256 = "929a451198f342ef0f6c4600aa7d3448670348e294ef09b022f2bf63510fe3a5",
)

maven_jar(
name = "grpc_auth_artifact",
artifact = "io.grpc:grpc-auth:1.0.0",
)

maven_jar(
name = "grpc_benchmarks_artifact",
artifact = "io.grpc:grpc-benchmarks:1.0.0",
)

maven_jar(
name = "grpc_core_artifact",
artifact = "io.grpc:grpc-core:1.0.0",
)

maven_jar(
name = "grpc_netty_artifact",
artifact = "io.grpc:grpc-netty:1.0.0",
)

maven_jar(
name = "grpc_protobuf_artifact",
artifact = "io.grpc:grpc-protobuf:1.0.0",
)

maven_jar(
name = "grpc_protobuf_lite_artifact",
artifact = "io.grpc:grpc-protobuf-lite:1.0.0",
)

maven_jar(
name = "grpc_stub_artifact",
artifact = "io.grpc:grpc-stub:1.0.0",
)

maven_jar(
name = "grpc_testing_artifact",
artifact = "io.grpc:grpc-testing:1.0.0",
)

maven_jar(
name = "guava_artifact",
artifact = "com.google.guava:guava:19.0",
)

maven_jar(
name = "junit_artifact",
artifact = "junit:junit:4.10",
)

maven_jar(
name = "netty_artifact",
artifact = "io.netty:netty-all:4.1.3.Final",
)

maven_jar(
name = "protobuf_java_artifact",
artifact = "com.google.protobuf:protobuf-java:3.0.0-beta-3"
)

maven_jar(
name = "protobuf_java_util_artifact",
artifact = "com.google.protobuf:protobuf-java-util:3.0.0-beta-3",
)

maven_jar(
name = "slf4j_api_artifact",
artifact= "org.slf4j:slf4j-api:1.7.13",
)

maven_jar(
name = "slf4j_simple_artifact",
artifact = "org.slf4j:slf4j-simple:1.7.13",
)

maven_jar(
name = "jul_to_slf4j_artifact",
artifact = "org.slf4j:jul-to-slf4j:1.7.13",
)

maven_jar(
name = "mockito_artifact",
artifact = "org.mockito:mockito-all:1.10.19",
)

maven_jar(
name = "truth_artifact",
artifact = "com.google.truth:truth:0.28",
)

maven_jar(
name = "protoc_jar_artifact",
artifact = "com.github.os72:protoc-jar:3.0.0-b2.1",
)

maven_jar(
name = "args4j_artifact",
artifact = "args4j:args4j:2.32",
)

maven_jar(
name = "google_oauth_client_artifact",
artifact = "com.google.oauth-client:google-oauth-client:1.20.0",
)

maven_jar(
name = "google_oauth2_http_artifact",
artifact = "com.google.auth:google-auth-library-oauth2-http:0.3.1",
)

maven_jar(
name = "google_auth_credentials_artifact",
artifact = "com.google.auth:google-auth-library-credentials:0.3.1",
)

maven_jar(
name = "google_http_client_artifact",
artifact = "com.google.http-client:google-http-client:1.20.0",
)

maven_jar(
name = "google_http_jackson2_artifact",
artifact = "com.google.http-client:google-http-client-jackson2:1.20.0",
)

maven_jar(
name = "jackson_core_artifact",
artifact = "com.fasterxml.jackson.core:jackson-core:2.6.3",
)

maven_jar(
name = "google_gson_artifact",
artifact = "com.google.code.gson:gson:2.6.2",
)
root@BLR1000015302:~/polyglot#

@maheshps1
Copy link
Author

Hi katre,
Did you get time to look at WORKSPACE?

@katre
Copy link
Member

katre commented Dec 19, 2016

I did take a look, sorry for not responding sooner.

I was incorrect, maven_jar does not work with experimental_repository_cache. The http_archive rules do. Also, there is a new version of maven_jar which uses maven directly and which will therefore cache everything locally in a.m2 file.

So, here are the steps I recommend:

Switch to the new maven_jar by adding the following line to your WORKSPACE:

load("@bazel_tools//tools/build_defs/repo:maven_rules.bzl", "maven_jar")

(This is written in the Skylark extension language, and uses the mvn binary on your system. It is slower than the old, native maven_jar, unfortunately, but much more flexible).

Continue to use --experimental_repository_cache to cache http_archive artifacts.

When you run the build on your local (networked) machine, it should correctly download all the maven artifacts into your ~/.m2/repository directory, and then copy them from there to the bazel external repository as needed.

Copy the http artifacts as you did with the directory passed to experimental_repository_cache. Also copy the ~/.m2/repository directory to the destination computer so it is reachable to your non-networked bazel.

I just tested turning off the network on my laptop and re-running 'bazel fetch' with your workspace, and bazel reported that it had all needed artifacts even without the need to go to the network.

Here is the commands I used, for reference:

cat deps.txt | xargs bazel fetch --experimental_repository_cache=/tmp/bazel-external-storage

I created deps.txt from the WORKSPACE you provided so I could test downloading the dependencies. I'll attach the WORKSPACE and deps.txt I created.

Good luck!
download.zip

@maheshps1
Copy link
Author

maheshps1 commented Dec 22, 2016

Now bazel is working fine in a PC having without internet connection.
Thank you very much Katre. Your sincere support and solution is appreciated. It smoothed our development now.
Also thanks to Damien Martin-Guillerez for his support.

@katre
Copy link
Member

katre commented Dec 22, 2016

Glad it's working now, I will close this issue but feel free to file a new one if you have further problems.

@katre katre closed this as completed Dec 22, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants