zeroflag opened a new pull request #475:
URL: https://github.com/apache/knox/pull/475


   ## What changes were proposed in this pull request?
   
   Trying to get rid of build instability errors like this:
   
   ```
   Error:  Failed to execute goal on project gateway-test-release: Could not 
resolve dependencies for project 
org.apache.knox:gateway-test-release:pom:1.6.0-SNAPSHOT: Failed to collect 
dependencies at org.eclipse.jetty:jetty-util-ajax:jar:9.4.34.v20201102: Failed 
to read artifact descriptor for 
org.eclipse.jetty:jetty-util-ajax:jar:9.4.34.v20201102: 
   Could not transfer artifact 
org.eclipse.jetty:jetty-util-ajax:pom:9.4.34.v20201102 from/to central 
(https://repo.maven.apache.org/maven2): transfer failed for 
https://repo.maven.apache.org/maven2/org/eclipse/jetty/jetty-util-ajax/9.4.34.v20201102/jetty-util-ajax-9.4.34.v20201102.pom:
 
   Connection timed out (Read failed) -> [Help 1]
   ```
   
   There is a `maven.wagon.http.retryHandler.count` parameter but it doesn't do 
anything by default because ConnectException is not retryable by default, so I 
had to set maven.wagon.http.retryHandler.nonRetryableClasses as well.
   
   This way I can see the retry related messages in the mvn outout.
   
   Many sources recommened `-Dhttp.keepAlive=false` because keepAlive 
connections are prone to be killed within docker for some reason.
   
   ## How was this patch tested?
   
   1.) Enable maven wagon logging to see retries:
   
   ```
   
org.slf4j.simpleLogger.log.org.apache.maven.wagon.providers.http.httpclient=on
   in
   ~/tools/apache-maven-3.8.1/conf/logging/simplelogger.properties
   ```
   
   2.) Simulate Connection Timeout by setting `10.255.255.1 
repo.maven.apache.org` in `/etc/hosts`
   
   3.) Run maven command with retry and checked the output:
   ```
   mvn  -Dmaven.wagon.http.retryHandler.count=2 
-Dmaven.wagon.http.retryHandler.class=default 
-Dmaven.wagon.http.retryHandler.nonRetryableClasses=java.io.InterruptedIOException
   -DskipTests -Dcheckstyle.skip=true -Dfindbugs.skip=true -Dpmd.skip=true 
-Drat.skip -Ppackage clean install
   ```
   
   Output:
   
   ```
   Downloading from central: 
https://repo.maven.apache.org/maven2/org/apache/velocity/velocity/1.5/velocity-1.5.pom
   [INFO] I/O exception 
(org.apache.maven.wagon.providers.http.httpclient.conn.HttpHostConnectException)
 caught when processing request to {s}->https://repo.maven.apache.org:443: 
Connect to repo.maven.apache.org:443 [repo.maven.apache.org/10.255.255.1] 
failed: Operation timed out (Connection timed out)
   [INFO] Retrying request to {s}->https://repo.maven.apache.org:443
   [INFO] I/O exception 
(org.apache.maven.wagon.providers.http.httpclient.conn.HttpHostConnectException)
 caught when processing request to {s}->https://repo.maven.apache.org:443: 
Connect to repo.maven.apache.org:443 [repo.maven.apache.org/10.255.255.1] 
failed: Operation timed out (Connection timed out)
   [INFO] Retrying request to {s}->https://repo.maven.apache.org:443
   ```
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@knox.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to