From aaf913acd3aef694398ef21785905b8958eef0a0 Mon Sep 17 00:00:00 2001 From: Lari Hotari Date: Tue, 27 Oct 2020 14:09:45 +0200 Subject: [PATCH] Limit maven http connection pool TTL in Github flows Fixes "Tranfer failed for https://repo.maven.apache.org/... .jar: Connection reset" type of failures in Github Flows environment Set maven.wagon.httpconnectionManager.ttlSeconds to 25 seconds. Besides this, set maven.wagon.http.retryHandler.count to 3 retries. https://issues.apache.org/jira/browse/WAGON-545 contains a recommendation "Azure users shall set the TTL to 240 seconds or less." The reason for the 25 second TTL is to ensure that it's shorter than any common firewall or NAT timeout. Some NATs have a 30 second idle timeout although that is very rare. There shouldn't be harm in using the 25 second TTL since the connection pool will be able to pool connections well with a 25 second TTL. The documentation for maven.wagon.httpconnectionManager.ttlSeconds is available in the source code: https://github.com/apache/maven-wagon/blob/wagon-3.4.1/wagon-providers/wagon-http-shared/src/main/java/org/apache/maven/wagon/shared/http/AbstractHttpClientWagon.java#L297-L305 Documentation for maven.wagon.http.retryHandler.count is in https://maven.apache.org/wagon/wagon-providers/wagon-http/ "Any retry handler can only react to exceptions when executing the request and receiving the response head. It will not salvage in-flight failures of ongoing response body streams." Therefore the retry count setting is a bit different than expected. WAGON-545 explains that ConnectionExceptions aren't part of the retried exceptions by default. If such issues become problems, it's possible to configure the retry handler in a more fine grained way. --- .github/workflows/bookie-tests.yml | 3 +++ .github/workflows/client-tests.yml | 3 +++ .github/workflows/compatibility-check-java11.yml | 3 +++ .github/workflows/compatibility-check-java8.yml | 3 +++ .github/workflows/integration-tests.yml | 3 +++ .github/workflows/pr-validation.yml | 3 +++ .github/workflows/remaining-tests.yml | 3 +++ .github/workflows/replication-tests.yml | 3 +++ .github/workflows/tls-tests.yml | 3 +++ 9 files changed, 27 insertions(+) diff --git a/.github/workflows/bookie-tests.yml b/.github/workflows/bookie-tests.yml index 875efcdea83..d668657fa84 100644 --- a/.github/workflows/bookie-tests.yml +++ b/.github/workflows/bookie-tests.yml @@ -27,6 +27,9 @@ on: - 'site/**' +env: + MAVEN_OPTS: -Dmaven.wagon.httpconnectionManager.ttlSeconds=25 -Dmaven.wagon.http.retryHandler.count=3 + jobs: test: diff --git a/.github/workflows/client-tests.yml b/.github/workflows/client-tests.yml index 159464dc17e..28999078695 100644 --- a/.github/workflows/client-tests.yml +++ b/.github/workflows/client-tests.yml @@ -27,6 +27,9 @@ on: - 'site/**' +env: + MAVEN_OPTS: -Dmaven.wagon.httpconnectionManager.ttlSeconds=25 -Dmaven.wagon.http.retryHandler.count=3 + jobs: test: diff --git a/.github/workflows/compatibility-check-java11.yml b/.github/workflows/compatibility-check-java11.yml index 55de1fbb0c1..4d333232c64 100644 --- a/.github/workflows/compatibility-check-java11.yml +++ b/.github/workflows/compatibility-check-java11.yml @@ -26,6 +26,9 @@ on: paths-ignore: - 'site/**' +env: + MAVEN_OPTS: -Dmaven.wagon.httpconnectionManager.ttlSeconds=25 -Dmaven.wagon.http.retryHandler.count=3 + jobs: check: diff --git a/.github/workflows/compatibility-check-java8.yml b/.github/workflows/compatibility-check-java8.yml index 271d2e00825..d94ddf61d4f 100644 --- a/.github/workflows/compatibility-check-java8.yml +++ b/.github/workflows/compatibility-check-java8.yml @@ -26,6 +26,9 @@ on: paths-ignore: - 'site/**' +env: + MAVEN_OPTS: -Dmaven.wagon.httpconnectionManager.ttlSeconds=25 -Dmaven.wagon.http.retryHandler.count=3 + jobs: check: diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index cd5f90b2893..bc7320e149c 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -27,6 +27,9 @@ on: - 'site/**' +env: + MAVEN_OPTS: -Dmaven.wagon.httpconnectionManager.ttlSeconds=25 -Dmaven.wagon.http.retryHandler.count=3 + jobs: test: diff --git a/.github/workflows/pr-validation.yml b/.github/workflows/pr-validation.yml index 5b2dc953652..3310950cccf 100644 --- a/.github/workflows/pr-validation.yml +++ b/.github/workflows/pr-validation.yml @@ -27,6 +27,9 @@ on: - 'site/**' +env: + MAVEN_OPTS: -Dmaven.wagon.httpconnectionManager.ttlSeconds=25 -Dmaven.wagon.http.retryHandler.count=3 + jobs: check: diff --git a/.github/workflows/remaining-tests.yml b/.github/workflows/remaining-tests.yml index 5aacf262a22..62497298121 100644 --- a/.github/workflows/remaining-tests.yml +++ b/.github/workflows/remaining-tests.yml @@ -26,6 +26,9 @@ on: paths-ignore: - 'site/**' +env: + MAVEN_OPTS: -Dmaven.wagon.httpconnectionManager.ttlSeconds=25 -Dmaven.wagon.http.retryHandler.count=3 + jobs: test: diff --git a/.github/workflows/replication-tests.yml b/.github/workflows/replication-tests.yml index b06017aafae..a4b6b0b8fea 100644 --- a/.github/workflows/replication-tests.yml +++ b/.github/workflows/replication-tests.yml @@ -27,6 +27,9 @@ on: - 'site/**' +env: + MAVEN_OPTS: -Dmaven.wagon.httpconnectionManager.ttlSeconds=25 -Dmaven.wagon.http.retryHandler.count=3 + jobs: test: diff --git a/.github/workflows/tls-tests.yml b/.github/workflows/tls-tests.yml index 43d17f75d6d..7eaad47aa78 100644 --- a/.github/workflows/tls-tests.yml +++ b/.github/workflows/tls-tests.yml @@ -27,6 +27,9 @@ on: - 'site/**' +env: + MAVEN_OPTS: -Dmaven.wagon.httpconnectionManager.ttlSeconds=25 -Dmaven.wagon.http.retryHandler.count=3 + jobs: test: