This is an automated email from the ASF dual-hosted git repository.

mmerli pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/bookkeeper.git


The following commit(s) were added to refs/heads/master by this push:
     new 7fbb8d89f8 Adjust DNS cache expiration in tests to reduce test timeout 
failures (#4586)
7fbb8d89f8 is described below

commit 7fbb8d89f880579035b5ba2752caf8583d34611a
Author: Lari Hotari <lhot...@users.noreply.github.com>
AuthorDate: Tue Apr 22 22:37:55 2025 +0300

    Adjust DNS cache expiration in tests to reduce test timeout failures (#4586)
---
 .github/workflows/bk-ci.yml                 | 14 ++++++++++++++
 pom.xml                                     |  6 +++---
 stream/distributedlog/common/pom.xml        |  2 +-
 stream/distributedlog/core/pom.xml          |  2 +-
 stream/distributedlog/pom.xml               |  2 +-
 stream/pom.xml                              |  2 +-
 tests/integration-tests-base-groovy/pom.xml |  2 +-
 7 files changed, 22 insertions(+), 8 deletions(-)

diff --git a/.github/workflows/bk-ci.yml b/.github/workflows/bk-ci.yml
index 6c40881bd5..10cfad1fc2 100644
--- a/.github/workflows/bk-ci.yml
+++ b/.github/workflows/bk-ci.yml
@@ -159,6 +159,13 @@ jobs:
           distribution: 'temurin'
           java-version: 11
 
+      - name: Tune Java DNS TTL settings
+        run: |
+          sudo tee -a $JAVA_HOME/conf/security/java.security <<EOF
+          networkaddress.cache.ttl=1
+          networkaddress.cache.negative.ttl=1
+          EOF
+
       - name: Build
         run: |
           projects_list=
@@ -233,6 +240,13 @@ jobs:
           distribution: 'temurin'
           java-version: 11
 
+      - name: Tune Java DNS TTL settings
+        run: |
+          sudo tee -a $JAVA_HOME/conf/security/java.security <<EOF
+          networkaddress.cache.ttl=1
+          networkaddress.cache.negative.ttl=1
+          EOF
+
       - name: Pick ubuntu mirror for the docker image build
         run: |
           # pick the closest ubuntu mirror and set it to UBUNTU_MIRROR 
environment variable
diff --git a/pom.xml b/pom.xml
index b88b02aa8b..d271cb7bd4 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1015,7 +1015,7 @@
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-surefire-plugin</artifactId>
         <configuration>
-          <argLine>-Xmx2G -Djava.net.preferIPv4Stack=true 
-Dio.netty.leakDetection.level=paranoid ${test.additional.args}</argLine>
+          <argLine>-Xmx2G -Dsun.net.inetaddr.ttl=1 
-Dsun.net.inetaddr.negative.ttl=1 -Djava.net.preferIPv4Stack=true 
-Dio.netty.leakDetection.level=paranoid ${test.additional.args}</argLine>
           
<redirectTestOutputToFile>${redirectTestOutputToFile}</redirectTestOutputToFile>
           <forkCount>${forkCount.variable}</forkCount>
           <reuseForks>false</reuseForks>
@@ -1311,7 +1311,7 @@
             <groupId>org.apache.maven.plugins</groupId>
             <artifactId>maven-surefire-plugin</artifactId>
             <configuration>
-              <argLine>-Xmx2G -Djava.net.preferIPv4Stack=true</argLine>
+              <argLine>-Xmx2G -Dsun.net.inetaddr.ttl=1 
-Dsun.net.inetaddr.negative.ttl=1 -Djava.net.preferIPv4Stack=true</argLine>
               <redirectTestOutputToFile>false</redirectTestOutputToFile>
               <forkCount>${forkCount.variable}</forkCount>
               <reuseForks>false</reuseForks>
@@ -1331,7 +1331,7 @@
             <groupId>org.apache.maven.plugins</groupId>
             <artifactId>maven-surefire-plugin</artifactId>
             <configuration>
-              <argLine>-Xmx2G -Djava.net.preferIPv4Stack=true 
-Dio.netty.leakDetection.level=paranoid -Dbookkeeper.log.root.level=INFO 
-Dbookkeeper.log.root.appender=CONSOLE</argLine>
+              <argLine>-Xmx2G -Dsun.net.inetaddr.ttl=1 
-Dsun.net.inetaddr.negative.ttl=1 -Djava.net.preferIPv4Stack=true 
-Dio.netty.leakDetection.level=paranoid -Dbookkeeper.log.root.level=INFO 
-Dbookkeeper.log.root.appender=CONSOLE</argLine>
               <redirectTestOutputToFile>false</redirectTestOutputToFile>
               <forkCount>${forkCount.variable}</forkCount>
               <reuseForks>false</reuseForks>
diff --git a/stream/distributedlog/common/pom.xml 
b/stream/distributedlog/common/pom.xml
index 118ee5e5d6..165882c1b9 100644
--- a/stream/distributedlog/common/pom.xml
+++ b/stream/distributedlog/common/pom.xml
@@ -109,7 +109,7 @@
         <artifactId>maven-surefire-plugin</artifactId>
         <configuration>
           
<redirectTestOutputToFile>${redirectTestOutputToFile}</redirectTestOutputToFile>
-          <argLine>-Xmx3G -Djava.net.preferIPv4Stack=true 
-XX:MaxDirectMemorySize=2G ${test.additional.args}</argLine>
+          <argLine>-Xmx3G -Dsun.net.inetaddr.ttl=1 
-Dsun.net.inetaddr.negative.ttl=1 -Djava.net.preferIPv4Stack=true 
-XX:MaxDirectMemorySize=2G ${test.additional.args}</argLine>
           <forkCount>1</forkCount>
           <reuseForks>false</reuseForks>
           <forkedProcessTimeoutInSeconds>1800</forkedProcessTimeoutInSeconds>
diff --git a/stream/distributedlog/core/pom.xml 
b/stream/distributedlog/core/pom.xml
index f1f34ca14a..d6207fe7ff 100644
--- a/stream/distributedlog/core/pom.xml
+++ b/stream/distributedlog/core/pom.xml
@@ -110,7 +110,7 @@
         <configuration>
           <trimStackTrace>false</trimStackTrace>
           
<redirectTestOutputToFile>${redirectTestOutputToFile}</redirectTestOutputToFile>
-          <argLine>-Xmx3G -Djava.net.preferIPv4Stack=true 
-XX:MaxDirectMemorySize=2G ${test.additional.args}</argLine>
+          <argLine>-Xmx3G -Dsun.net.inetaddr.ttl=1 
-Dsun.net.inetaddr.negative.ttl=1 -Djava.net.preferIPv4Stack=true 
-XX:MaxDirectMemorySize=2G ${test.additional.args}</argLine>
           <forkCount>1</forkCount>
           <reuseForks>false</reuseForks>
           <forkedProcessTimeoutInSeconds>1800</forkedProcessTimeoutInSeconds>
diff --git a/stream/distributedlog/pom.xml b/stream/distributedlog/pom.xml
index 1530eedffb..1b024888a9 100644
--- a/stream/distributedlog/pom.xml
+++ b/stream/distributedlog/pom.xml
@@ -75,7 +75,7 @@
         <artifactId>maven-surefire-plugin</artifactId>
         <configuration>
           
<redirectTestOutputToFile>${redirectTestOutputToFile}</redirectTestOutputToFile>
-          <argLine>-Xmx3G -Djava.net.preferIPv4Stack=true 
-XX:MaxDirectMemorySize=2G -Dio.netty.leakDetection.level=PARANOID 
${test.additional.args}</argLine>
+          <argLine>-Xmx3G -Dsun.net.inetaddr.ttl=1 
-Dsun.net.inetaddr.negative.ttl=1 -Djava.net.preferIPv4Stack=true 
-XX:MaxDirectMemorySize=2G -Dio.netty.leakDetection.level=PARANOID 
${test.additional.args}</argLine>
           <forkCount>1</forkCount>
           <reuseForks>false</reuseForks>
           <forkedProcessTimeoutInSeconds>1800</forkedProcessTimeoutInSeconds>
diff --git a/stream/pom.xml b/stream/pom.xml
index 72bebc1342..0c0fe66b75 100644
--- a/stream/pom.xml
+++ b/stream/pom.xml
@@ -57,7 +57,7 @@
           <!-- only run tests when -DstreamTests is specified //-->
           <skipTests>true</skipTests>
           
<redirectTestOutputToFile>${redirectTestOutputToFile}</redirectTestOutputToFile>
-          <argLine>-Xmx3G -Djava.net.preferIPv4Stack=true 
-XX:MaxDirectMemorySize=2G -Dio.netty.leakDetection.level=PARANOID 
${test.additional.args}</argLine>
+          <argLine>-Xmx3G -Dsun.net.inetaddr.ttl=1 
-Dsun.net.inetaddr.negative.ttl=1 -Djava.net.preferIPv4Stack=true 
-XX:MaxDirectMemorySize=2G -Dio.netty.leakDetection.level=PARANOID 
${test.additional.args}</argLine>
           <forkCount>1</forkCount>
           <reuseForks>false</reuseForks>
           <forkedProcessTimeoutInSeconds>1800</forkedProcessTimeoutInSeconds>
diff --git a/tests/integration-tests-base-groovy/pom.xml 
b/tests/integration-tests-base-groovy/pom.xml
index 5b2901899c..1daa998f37 100644
--- a/tests/integration-tests-base-groovy/pom.xml
+++ b/tests/integration-tests-base-groovy/pom.xml
@@ -67,7 +67,7 @@
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-surefire-plugin</artifactId>
         <configuration>
-          <argLine>-Xmx4G -Djava.net.preferIPv4Stack=true 
${test.additional.args}</argLine>
+          <argLine>-Xmx4G -Dsun.net.inetaddr.ttl=1 
-Dsun.net.inetaddr.negative.ttl=1 -Djava.net.preferIPv4Stack=true 
${test.additional.args}</argLine>
           <forkCount>1</forkCount>
           <useSystemClassLoader>false</useSystemClassLoader>
         </configuration>

Reply via email to