Skip to content

Commit 532f506

Browse files
committed
fix: stabilize ExtensionLifecycleIntegrationTest on Java 8 and 17
Add attachDelayMs=500 and increase checkLines to 10 to match the established pattern from BTraceFunctionalTests.testExtensionLifecycleClose(). The original checkLines values (2-3) caused the CountDownLatch to hit 0 almost immediately after the BTrace client INFO line, returning from attach() before the probe had finished executing. The test then triggered target app shutdown, racing the BTrace output flush. This was JDK-version-sensitive: Java 8 and 17 lost the race consistently while Java 11/21/25/26 were fast enough to avoid it. With checkLines=10 (more than actual output lines), attach() waits up to the full timeout, giving the probe time to complete. The 500ms attach delay allows the target JVM to stabilize before probe injection. <!-- muse-session:impl-20260412-130225 -->
1 parent c858269 commit 532f506

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

integration-tests/src/test/java/tests/ExtensionLifecycleIntegrationTest.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,12 @@ public void reset() {
6060

6161
@Test
6262
public void testExtensionInitializeAndCloseCalled() throws Exception {
63+
attachDelayMs = 500;
6364
testDynamic(
6465
"resources.Main",
6566
"btrace/ExtensionLifecycleFullTest.java",
6667
new String[] {"extensionCloseTest=true"},
67-
2,
68+
10,
6869
new ResultValidator() {
6970
@Override
7071
public void validate(String stdout, String stderr, int retcode, String jfrFile) {
@@ -80,11 +81,12 @@ public void validate(String stdout, String stderr, int retcode, String jfrFile)
8081

8182
@Test
8283
public void testExtensionCloseCalledOnError() throws Exception {
84+
attachDelayMs = 500;
8385
testDynamic(
8486
"resources.Main",
8587
"btrace/ExtensionLifecycleErrorTest.java",
8688
new String[] {"extensionCloseTest=true"},
87-
2,
89+
10,
8890
new ResultValidator() {
8991
@Override
9092
public void validate(String stdout, String stderr, int retcode, String jfrFile) {
@@ -101,11 +103,12 @@ public void validate(String stdout, String stderr, int retcode, String jfrFile)
101103

102104
@Test
103105
public void testMultipleExtensionsAllClosed() throws Exception {
106+
attachDelayMs = 500;
104107
testDynamic(
105108
"resources.Main",
106109
"btrace/ExtensionLifecycleMultipleTest.java",
107110
new String[] {"extensionCloseTest=true"},
108-
3,
111+
10,
109112
new ResultValidator() {
110113
@Override
111114
public void validate(String stdout, String stderr, int retcode, String jfrFile) {

0 commit comments

Comments
 (0)