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

lushiji pushed a commit to branch branch-4.16
in repository https://gitbox.apache.org/repos/asf/bookkeeper.git


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

commit 065b9feb94838377f85157809a535eb470c04975
Author: Lari Hotari <[email protected]>
AuthorDate: Tue Apr 22 22:37:55 2025 +0300

    Adjust DNS cache expiration in tests to reduce test timeout failures (#4586)
    
    (cherry picked from commit 7fbb8d89f880579035b5ba2752caf8583d34611a)
---
 .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 19bdbfa9b1..c7e23a8c6f 100644
--- a/.github/workflows/bk-ci.yml
+++ b/.github/workflows/bk-ci.yml
@@ -155,6 +155,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=
@@ -229,6 +236,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 d9df195307..0456bcf7f2 100644
--- a/pom.xml
+++ b/pom.xml
@@ -981,7 +981,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>
@@ -1298,7 +1298,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>
@@ -1318,7 +1318,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 ace02d2328..f349e46982 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 829f87347a..5394afaab1 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 8b58e847ce..7782decff1 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 8fa49ed367..eae3285744 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 9cfe7845a4..06a406666d 100644
--- a/tests/integration-tests-base-groovy/pom.xml
+++ b/tests/integration-tests-base-groovy/pom.xml
@@ -68,7 +68,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>
           <systemPropertyVariables>

Reply via email to