-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Description
Took recently 5.8.0 release in my project that depends on Curator and some tests were running really slow compared with previous versions (5.7.1, 5.7.0)
I took a closer look and CuratorFramework.close is invoked ZK server is stop (
I have included a test that makes reproduction easy and shows that with Curator 5.8.0 close() method takes 20 times longer to complete.
- Curator 5.7.1 closing Curator instance takes 1200 millis
- Curator 5.8.0 closing Curator instance takes 20000 millis
package com.cheva.grantor;
import static java.util.concurrent.TimeUnit.SECONDS;
import static org.junit.jupiter.api.Assertions.assertTrue;
import java.time.Duration;
import java.time.Instant;
import org.apache.curator.framework.CuratorFramework;
import org.apache.curator.framework.CuratorFrameworkFactory;
import org.apache.curator.retry.RetryOneTime;
import org.apache.curator.test.BaseClassForTests;
import org.junit.jupiter.api.Test;
class CuratorCloseSlow extends BaseClassForTests {
@test
void tesCuratorCloseSlow() throws Exception {
Instant t0;
try (CuratorFramework cf =
CuratorFrameworkFactory.newClient(server.getConnectString(), new RetryOneTime(1_000))) {
cf.start();
assertTrue(cf.blockUntilConnected(2, SECONDS));
cf.create().forPath("/jejeje");
server.stop();
Thread.sleep(100L);
t0 = Instant.now();
}
Instant t1 = Instant.now();
long closeDurationMillis = Duration.between(t0, t1).toMillis();
System.out.println("Close Duration took " + closeDurationMillis + " millis");
assertTrue(closeDurationMillis < 2_000L);
}
}
I am running Linux with OpenJDK
openjdk version "17.0.14" 2025-01-21
OpenJDK Runtime Environment (build 17.0.14+7)
OpenJDK 64-Bit Server VM (build 17.0.14+7, mixed mode, sharing)
Linux cheva-virtualmachine 6.6.75-2-MANJARO #1 SMP PREEMPT_DYNAMIC Mon Feb 3 17:53:46 UTC 2025 x86_64 GNU/Linux
Thanks,
Cheva