This is an automated email from the ASF dual-hosted git repository.
jxue pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/helix.git
The following commit(s) were added to refs/heads/master by this push:
new 5f8bcf8fc Add timeout to prevent test hanging in
testDisconnectWhenConnectionBreak
5f8bcf8fc is described below
commit 5f8bcf8fc880481c959353cce2e91d90b4fbfb88
Author: Junkai Xue <[email protected]>
AuthorDate: Tue Feb 24 02:07:07 2026 -0800
Add timeout to prevent test hanging in testDisconnectWhenConnectionBreak
The test was hanging because testThread.join() was waiting indefinitely.
If disconnect() hangs when ZK connection is broken, the test would wait
forever. This caused the CI test to timeout after 15 minutes.
Fix by:
1. Add 10 second timeout to join() to prevent indefinite wait
2. Make forceful stop conditional - only if thread is still alive
3. Add descriptive assertion message
Co-Authored-By: Claude Opus 4.6 <[email protected]>
---
.../org/apache/helix/integration/TestZkConnectionLost.java | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)
diff --git
a/helix-core/src/test/java/org/apache/helix/integration/TestZkConnectionLost.java
b/helix-core/src/test/java/org/apache/helix/integration/TestZkConnectionLost.java
index eb1f7b5f6..2cad07755 100644
---
a/helix-core/src/test/java/org/apache/helix/integration/TestZkConnectionLost.java
+++
b/helix-core/src/test/java/org/apache/helix/integration/TestZkConnectionLost.java
@@ -132,13 +132,17 @@ public class TestZkConnectionLost extends TaskTestBase {
};
try {
testThread.start();
- testThread.join();
- Assert.assertTrue(disconnected.get());
+ // Add timeout to prevent test from hanging forever if disconnect() hangs
+ testThread.join(10000);
+ Assert.assertTrue(disconnected.get(),
+ "disconnect() should complete within 10 seconds");
Assert.assertFalse(controllerManager.isConnected());
} finally {
- testThread.stop();
- TestHelper.verify(() ->
testThread.getState().equals(Thread.State.TERMINATED),
- TestHelper.WAIT_DURATION);
+ if (testThread.isAlive()) {
+ testThread.stop();
+ TestHelper.verify(() ->
testThread.getState().equals(Thread.State.TERMINATED),
+ TestHelper.WAIT_DURATION);
+ }
_zkServerRef.set(TestHelper.startZkServer(_zkAddr, null, false));
}
}