Skip to content

Commit

Permalink
Attempt to improve random connection errors in CI (#871)
Browse files Browse the repository at this point in the history
This adds a Maven settings.xml file which contains the necessary settings to lower the TTL for connections in the connection pool used by Maven to download artifacts.

This is to work around an issue where Azure would silently terminate connections that have been idle for more than 4 minutes causing weird aborts in GitHub
  • Loading branch information
lfrancke authored Sep 18, 2024
1 parent 1856397 commit 0a376b0
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
2 changes: 2 additions & 0 deletions java-devel/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ RUN microdnf update && \

ENV JAVA_HOME=/usr/lib/jvm/jre-${PRODUCT}

COPY --chown=stackable:0 java-devel/stackable/settings.xml /stackable/.m2/settings.xml

# Mitigation for CVE-2021-44228 (Log4Shell)
# This variable is supported as of Log4j version 2.10 and
# disables the vulnerable feature
Expand Down
29 changes: 29 additions & 0 deletions java-devel/stackable/settings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<settings>
<profiles>
<profile>
<id>stackable</id>
<properties>
<!--
This is to work around an issue where Maven builds in Github Actions would randomly fail.
There is some evidence that points at Azure networking as the root cause where it closes idle connections (silently) after 4 minutes.
Maven would then sometimes reuse an "old" connection from its connection pool and would encounter issues due to these connection closures.
This patch changes the TTL for the connections to a lower value than 4 minutes (240s), the default is 300s (5min).
There are two properties here because sometimes in November 2023 the name was changed.
The new name will only take effect as of Maven 4, but it doesn't hurt to add it here already, therefore, we just add both properties here.
https://issues.apache.org/jira/browse/MRESOLVER-440
-->

<!-- Old name: maven-resolver 1.x, Maven 3.x -->
<aether.connector.http.connectionMaxTtl>30</aether.connector.http.connectionMaxTtl>

<!-- New name: maven-resolver 2.x, as of Maven 4.x -->
<aether.transport.http.connectionMaxTtl>30</aether.transport.http.connectionMaxTtl>
</properties>
</profile>
</profiles>
<activeProfiles>
<!--make the stackable profile active all the time -->
<activeProfile>stackable</activeProfile>
</activeProfiles>
</settings>

0 comments on commit 0a376b0

Please sign in to comment.