Couchbase connection issues during spring java start

Hello,

We have a java application that connects to multiple couch-base buckets. During the startup of spring we are getting the below error

Connect attempt 1 failed because of TimeoutException: Did not observe any item or terminal signal within 10000ms in \u0027source(MonoDefer)\u0027

We connect to these buckets similar to shown below

Private String consulDNS = “couchbase-xxx.service.consul”;
public @Bean Cluster getClusterInstance() {
ClusterEnvironment env = ClusterEnvironment.builder()
.ioConfig(IoConfig.enableDnsSrv(true))
.timeoutConfig(TimeoutConfig.kvTimeout(Duration.ofSeconds(5)))
.build();

    if (cluster == null) {
        cluster = Cluster.connect(consulDNS,
                ClusterOptions.clusterOptions(username, password)
                        .environment(env));
    }
  
    return cluster;
}

public @Bean(“bucket1”)
Bucket connectBucket1() {
Bucket bucket = cluster.bucket(“bucket1”);
bucket.waitUntilReady(Duration.ofMinutes(1));
return bucket;
}

public @Bean(“bucket2”)
Bucket connectBucket2() {
Bucket bucket = cluster.bucket(“bucket2”);
bucket.waitUntilReady(Duration.ofMinutes(1));
return bucket;
}

Out of 10 times when we start the application we get 5-6 times this issue. Rest all times it starts fine without any issues. We use couchbase java client 3.0.10. Also note when we have only one bucket connection then we are not facing this issue. Can someone help us what could be the reason for this startup failure issue?

Thanks

@y2k1975 Thank you for using Couchbase as your Database of choice. What is the version of Couchbase Server you are connecting to? Can you check if you are seeing any client side logs to see if you find any errors? I am not able to reproduce this error

@raju We are using 6.5 version with Java couch client 3.0. As of now we are trying with waitUntilReady at cluster level instead of bucket level. I will keep you guys posted if the issue is occurring again as it was random.