I am trying to disconnect to my Couchbase cluster using cluster.disconnect(Duration.ofSeconds(60))
but the thread never moves ahead, even after wait times out. I took a thread dump and found this:
"Thread-163" #197 prio=5 os_prio=31 cpu=12.51ms elapsed=84.72s tid=0x00007fa4065e2400 nid=0xce03 waiting on condition [0x000070000eada000]
java.lang.Thread.State: WAITING (parking)
at jdk.internal.misc.Unsafe.park(java.base@15.0.2/Native Method)
- parking to wait for <0x0000000702a769b0> (a java.util.concurrent.CompletableFuture$Signaller)
at java.util.concurrent.locks.LockSupport.park(java.base@15.0.2/LockSupport.java:211)
at java.util.concurrent.CompletableFuture$Signaller.block(java.base@15.0.2/CompletableFuture.java:1860)
at java.util.concurrent.ForkJoinPool.managedBlock(java.base@15.0.2/ForkJoinPool.java:3137)
at java.util.concurrent.CompletableFuture.waitingGet(java.base@15.0.2/CompletableFuture.java:1887)
at java.util.concurrent.CompletableFuture.get(java.base@15.0.2/CompletableFuture.java:2062)
at com.couchbase.client.java.AsyncUtils.block(AsyncUtils.java:38)
at com.couchbase.client.java.Cluster.disconnect(Cluster.java:478)
at xxx.xxxx.xxxx.xxxx.xxxx.event.eventlistener.MyApplicationSQSListener.lambda$poll$0(FeedScribeSQSListener.java:70)
at xxx.xxxx.xxxx.xxxx.xxxx.event.eventlistener.Application.$$Lambda$1018/0x00000008013f2c38.run(Unknown Source)
at java.lang.Thread.run(java.base@15.0.2/Thread.java:832)
Looks like the shutdown thread is stuck waiting for a monitor.
Here is my Couchbase configuration:
@Configuration
public class CouchbaseConfiguration {
@Autowired private CommonProperties properties;
@Bean
public ClusterEnvironment clusterEnvironment() {
return ClusterEnvironment.create();
}
@Bean
public Cluster cluster() {
return Cluster.connect(
properties.getCouchbase().getConnectionString(),
ClusterOptions.clusterOptions(
properties.getCouchbase().getUsername(), properties.getCouchbase().getPassword())
.environment(clusterEnvironment()));
}
@Bean
public ReactiveCluster reactiveCluster(Cluster cluster) {
return cluster.reactive();
}
@Bean
public ReactiveBucket reactiveBucket(Cluster cluster) {
return cluster.bucket(properties.getCouchbase().getBucket()).reactive();
}
@Bean
public CouchbaseConnector couchbaseConnector(CommonProperties properties) {
return new CouchbaseConnector();
}
}
My SDK version: 3.1.2