This is an automated email from the ASF dual-hosted git repository.
lhotari pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pulsar.git
The following commit(s) were added to refs/heads/master by this push:
new 5067d0d4a58 [fix][test] Fix flaky ConnectionTimeoutTest by correcting
latch count (#25320)
5067d0d4a58 is described below
commit 5067d0d4a58a55344ee72f5008c5039684037e11
Author: Matteo Merli <[email protected]>
AuthorDate: Sun Mar 15 23:55:35 2026 -0700
[fix][test] Fix flaky ConnectionTimeoutTest by correcting latch count
(#25320)
---
.../java/org/apache/pulsar/client/impl/ConnectionTimeoutTest.java | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git
a/pulsar-client/src/test/java/org/apache/pulsar/client/impl/ConnectionTimeoutTest.java
b/pulsar-client/src/test/java/org/apache/pulsar/client/impl/ConnectionTimeoutTest.java
index b88a8679a69..199e3619d4b 100644
---
a/pulsar-client/src/test/java/org/apache/pulsar/client/impl/ConnectionTimeoutTest.java
+++
b/pulsar-client/src/test/java/org/apache/pulsar/client/impl/ConnectionTimeoutTest.java
@@ -29,10 +29,12 @@ import java.util.concurrent.CompletableFuture;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
+import lombok.extern.slf4j.Slf4j;
import org.apache.pulsar.client.api.PulsarClient;
import org.testng.Assert;
import org.testng.annotations.Test;
+@Slf4j
public class ConnectionTimeoutTest {
@Test
@@ -41,12 +43,15 @@ public class ConnectionTimeoutTest {
// create a dummy server and fill the backlog of the server so that it
won't respond
// so that the client timeout can be tested with this server
try (ServerSocket serverSocket = new ServerSocket(0, backlogSize,
InetAddress.getByName("localhost"))) {
- CountDownLatch latch = new CountDownLatch(backlogSize + 1);
+
+ // We to just leave 1 task pending, otherwise we don't have a
chance to attemp to connect the Pulsar client
+ CountDownLatch latch = new CountDownLatch(backlogSize);
List<Thread> threads = new ArrayList<>();
for (int i = 0; i < backlogSize + 1; i++) {
Thread connectThread = new Thread(() -> {
try (Socket socket = new Socket()) {
socket.connect(serverSocket.getLocalSocketAddress());
+ log.info("Connected to {}",
socket.getRemoteSocketAddress());
latch.countDown();
Thread.sleep(10000L);
} catch (IOException e) {