Netflix / conductor

Conductor is a microservices orchestration engine.
Apache License 2.0
12.82k stars 2.34k forks source link

Error Download Gradle bin #3339

Open jegadjame opened 1 year ago

jegadjame commented 1 year ago

Hi, I am getting below error when i run docker-compose up.

Note: I executed git config --global core.autocrlf false and cloned again and ran docker-compose up.. Still getting same error . I am using windows 10 machine

Step 5/15 : RUN ./gradlew build -x test --stacktrace ---> Running in 05a800bde887 Downloading https://services.gradle.org/distributions/gradle-7.5.1-bin.zip

Exception in thread "main" java.io.IOException: Downloading from https://services.gradle.org/distributions/gradle-7.5.1-bin.zip failed: timeout at org.gradle.wrapper.Download.downloadInternal(Download.java:122) at org.gradle.wrapper.Download.download(Download.java:80) at org.gradle.wrapper.Install$1.call(Install.java:83) at org.gradle.wrapper.Install$1.call(Install.java:63) at org.gradle.wrapper.ExclusiveFileAccessManager.access(ExclusiveFileAccessManager.java:69) at org.gradle.wrapper.Install.createDist(Install.java:63) at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:107) at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:63) Caused by: java.net.SocketTimeoutException: connect timed out at java.base/java.net.PlainSocketImpl.socketConnect(Native Method) at java.base/java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:412) at java.base/java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:255) at java.base/java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:237) at java.base/java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) at java.base/java.net.Socket.connect(Socket.java:609) at java.base/sun.security.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:305) at java.base/sun.net.NetworkClient.doConnect(NetworkClient.java:177) at java.base/sun.net.www.http.HttpClient.openServer(HttpClient.java:507) at java.base/sun.net.www.http.HttpClient.openServer(HttpClient.java:602) at java.base/sun.net.www.protocol.https.HttpsClient.(HttpsClient.java:266) at java.base/sun.net.www.protocol.https.HttpsClient.New(HttpsClient.java:373) at java.base/sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.getNewHttpClient(AbstractDelegateHttpsURLConnection.java:207) at java.base/sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1187) at java.base/sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:1081) at java.base/sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:193) at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1592) at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1520) at java.base/sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:250) at org.gradle.wrapper.Download.downloadInternal(Download.java:100) ... 7 more The command '/bin/sh -c ./gradlew build -x test --stacktrace' returned a non-zero code: 1 Service 'conductor-server' failed to build : Build failed

Thanks in advance, Jegadeesh

manan164 commented 1 year ago

Hi @jegadjame Please follow the steps,

  1. Delete your current conductor folder
  2. Run git config --global core.autocrlf false;
  3. Run git config --global core.eol lf; (Small L and f)
  4. Clone conductor repo again
  5. Check if end of lines shows as CRLF via NotePad++ by opening a DockerFile, e.g. => conductor/docker/server/DockerFile
  6. Run docker-compose up on conductor/docker
s50600822 commented 1 year ago

That has nothing to do with conductor or gradle but your own network.

Caused by: java.net.SocketTimeoutException: connect timed out
at java.base/java.net.PlainSocketImpl.socketConnect(Native Method)

This often happen when you are behind a firewall/proxy and your TCP handshake is dropped, the request never reach https://services.gradle.org/distributions/gradle-7.5.1-bin.zip outside. Timeout here is timeout waiting for an ACK, to establish the connection, no response comeback since the request never got to the other side, your client simply wait - typically for 60 secs - then threw a Timeout. Either check your firewall, network ACL or ask your IT.

A better solution is to download https://services.gradle.org/distributions/gradle-7.5.1-bin.zip and upload this to your private artifactory(where traffic between your computer and the repository is unrestricted). Then in your corresponding https://github.com/Netflix/conductor/blob/main/gradle/wrapper/gradle-wrapper.properties, point to that instead:

distributionUrl=https\://SomethingSomethingArtifactory/SomethingLib/SomethingGradle/distributions/gradle-7.5.1-bin.zip

If curious you can reproduce such issue/stack trace by spinning up a container with certain config simulating a firewall dropping outgoing request with certain host

docker run -it  --privileged --cap-drop=ALL --cap-add=NET_BIND_SERVICE --cap-add=NET_ADMIN eclipse-temurin:11-jdk-focal bash

apt-get update
apt-get install -y iptables

#simulate firewall dropping traffic to services.gradle.org and github.com
iptables -A OUTPUT -p tcp --dport 443 -d services.gradle.org  -j DROP
iptables -A OUTPUT -p tcp --dport 443 -d github.com -j DROP

With this container, if you mount conductor source code into it and run gradle build, you should see the JVM spit out the same error while trying to download Gradle bin. Alternatively you can do some simple Java class like https://github.com/s50600822/TestConnection and see similar behavior.