Skip to content

Commit 065b9fe

Browse files
lhotariStevenLuMT
authored andcommitted
Adjust DNS cache expiration in tests to reduce test timeout failures (#4586)
(cherry picked from commit 7fbb8d8)
1 parent 0d31202 commit 065b9fe

File tree

7 files changed

+22
-8
lines changed

7 files changed

+22
-8
lines changed

.github/workflows/bk-ci.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,13 @@ jobs:
155155
distribution: 'temurin'
156156
java-version: 11
157157

158+
- name: Tune Java DNS TTL settings
159+
run: |
160+
sudo tee -a $JAVA_HOME/conf/security/java.security <<EOF
161+
networkaddress.cache.ttl=1
162+
networkaddress.cache.negative.ttl=1
163+
EOF
164+
158165
- name: Build
159166
run: |
160167
projects_list=
@@ -229,6 +236,13 @@ jobs:
229236
distribution: 'temurin'
230237
java-version: 11
231238

239+
- name: Tune Java DNS TTL settings
240+
run: |
241+
sudo tee -a $JAVA_HOME/conf/security/java.security <<EOF
242+
networkaddress.cache.ttl=1
243+
networkaddress.cache.negative.ttl=1
244+
EOF
245+
232246
- name: Pick ubuntu mirror for the docker image build
233247
run: |
234248
# pick the closest ubuntu mirror and set it to UBUNTU_MIRROR environment variable

pom.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -981,7 +981,7 @@
981981
<groupId>org.apache.maven.plugins</groupId>
982982
<artifactId>maven-surefire-plugin</artifactId>
983983
<configuration>
984-
<argLine>-Xmx2G -Djava.net.preferIPv4Stack=true -Dio.netty.leakDetection.level=paranoid ${test.additional.args}</argLine>
984+
<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>
985985
<redirectTestOutputToFile>${redirectTestOutputToFile}</redirectTestOutputToFile>
986986
<forkCount>${forkCount.variable}</forkCount>
987987
<reuseForks>false</reuseForks>
@@ -1298,7 +1298,7 @@
12981298
<groupId>org.apache.maven.plugins</groupId>
12991299
<artifactId>maven-surefire-plugin</artifactId>
13001300
<configuration>
1301-
<argLine>-Xmx2G -Djava.net.preferIPv4Stack=true</argLine>
1301+
<argLine>-Xmx2G -Dsun.net.inetaddr.ttl=1 -Dsun.net.inetaddr.negative.ttl=1 -Djava.net.preferIPv4Stack=true</argLine>
13021302
<redirectTestOutputToFile>false</redirectTestOutputToFile>
13031303
<forkCount>${forkCount.variable}</forkCount>
13041304
<reuseForks>false</reuseForks>
@@ -1318,7 +1318,7 @@
13181318
<groupId>org.apache.maven.plugins</groupId>
13191319
<artifactId>maven-surefire-plugin</artifactId>
13201320
<configuration>
1321-
<argLine>-Xmx2G -Djava.net.preferIPv4Stack=true -Dio.netty.leakDetection.level=paranoid -Dbookkeeper.log.root.level=INFO -Dbookkeeper.log.root.appender=CONSOLE</argLine>
1321+
<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>
13221322
<redirectTestOutputToFile>false</redirectTestOutputToFile>
13231323
<forkCount>${forkCount.variable}</forkCount>
13241324
<reuseForks>false</reuseForks>

stream/distributedlog/common/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@
109109
<artifactId>maven-surefire-plugin</artifactId>
110110
<configuration>
111111
<redirectTestOutputToFile>${redirectTestOutputToFile}</redirectTestOutputToFile>
112-
<argLine>-Xmx3G -Djava.net.preferIPv4Stack=true -XX:MaxDirectMemorySize=2G ${test.additional.args}</argLine>
112+
<argLine>-Xmx3G -Dsun.net.inetaddr.ttl=1 -Dsun.net.inetaddr.negative.ttl=1 -Djava.net.preferIPv4Stack=true -XX:MaxDirectMemorySize=2G ${test.additional.args}</argLine>
113113
<forkCount>1</forkCount>
114114
<reuseForks>false</reuseForks>
115115
<forkedProcessTimeoutInSeconds>1800</forkedProcessTimeoutInSeconds>

stream/distributedlog/core/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@
110110
<configuration>
111111
<trimStackTrace>false</trimStackTrace>
112112
<redirectTestOutputToFile>${redirectTestOutputToFile}</redirectTestOutputToFile>
113-
<argLine>-Xmx3G -Djava.net.preferIPv4Stack=true -XX:MaxDirectMemorySize=2G ${test.additional.args}</argLine>
113+
<argLine>-Xmx3G -Dsun.net.inetaddr.ttl=1 -Dsun.net.inetaddr.negative.ttl=1 -Djava.net.preferIPv4Stack=true -XX:MaxDirectMemorySize=2G ${test.additional.args}</argLine>
114114
<forkCount>1</forkCount>
115115
<reuseForks>false</reuseForks>
116116
<forkedProcessTimeoutInSeconds>1800</forkedProcessTimeoutInSeconds>

stream/distributedlog/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@
7575
<artifactId>maven-surefire-plugin</artifactId>
7676
<configuration>
7777
<redirectTestOutputToFile>${redirectTestOutputToFile}</redirectTestOutputToFile>
78-
<argLine>-Xmx3G -Djava.net.preferIPv4Stack=true -XX:MaxDirectMemorySize=2G -Dio.netty.leakDetection.level=PARANOID ${test.additional.args}</argLine>
78+
<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>
7979
<forkCount>1</forkCount>
8080
<reuseForks>false</reuseForks>
8181
<forkedProcessTimeoutInSeconds>1800</forkedProcessTimeoutInSeconds>

stream/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
<!-- only run tests when -DstreamTests is specified //-->
5858
<skipTests>true</skipTests>
5959
<redirectTestOutputToFile>${redirectTestOutputToFile}</redirectTestOutputToFile>
60-
<argLine>-Xmx3G -Djava.net.preferIPv4Stack=true -XX:MaxDirectMemorySize=2G -Dio.netty.leakDetection.level=PARANOID ${test.additional.args}</argLine>
60+
<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>
6161
<forkCount>1</forkCount>
6262
<reuseForks>false</reuseForks>
6363
<forkedProcessTimeoutInSeconds>1800</forkedProcessTimeoutInSeconds>

tests/integration-tests-base-groovy/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@
6868
<groupId>org.apache.maven.plugins</groupId>
6969
<artifactId>maven-surefire-plugin</artifactId>
7070
<configuration>
71-
<argLine>-Xmx4G -Djava.net.preferIPv4Stack=true ${test.additional.args}</argLine>
71+
<argLine>-Xmx4G -Dsun.net.inetaddr.ttl=1 -Dsun.net.inetaddr.negative.ttl=1 -Djava.net.preferIPv4Stack=true ${test.additional.args}</argLine>
7272
<forkCount>1</forkCount>
7373
<useSystemClassLoader>false</useSystemClassLoader>
7474
<systemPropertyVariables>

0 commit comments

Comments
 (0)