0
  • spring-data-couchbase 2.0.0.RELEASE

  • 4.0.0-4047 Community Edition (build-4047)

At times I face connection timeout exception being thrown

Caused by: com.couchbase.client.deps.io.netty.channel.ConnectTimeoutException: connection timed out

I am using following environment configuration

@Override
protected CouchbaseEnvironment getEnvironment() {
    return DefaultCouchbaseEnvironment.builder()
            .connectTimeout(TimeUnit.SECONDS.toMillis(100))
            .computationPoolSize(6).autoreleaseAfter(9000).build();
}

my databuckets are auto wired in my services and I in one particular use case, I update a few documents across two data bucket. In case of connection being a bit iffy I get this exception and I am left with corrupt data of not all docs getting updated. Is there any connection retry mechanism which I can use if in case of connection failure?

1 Answers1

0

As a temporary attempt to fix, can you try forcing the Couchbase Java SDK to bump to version 2.2.4? Add this to your pom.xml's <dependencies> section:

<dependency>
    <groupId>com.couchbase.client</groupId>
    <artifactId>java-client</artifactId>
    <version>2.2.4</version>
</dependency>
Simon Baslé
  • 27,105
  • 5
  • 69
  • 70
  • Thanks for the reply but Could you please elaborate how does that help in connection retrying mechanism? – Anuj Bhatnagar Feb 19 '16 at 11:47
  • Spring Data Couchbase 2.0 was released with Couchbase SDK 2.2.3, but 2.2.4 fixes a bug preventing reconnection in some instances... But actually can you also confirm that you've correctly configured Couchbase bootstrap hosts? (the IPs from which to initiate connection to the cluster) and that these hosts are reachable? – Simon Baslé Feb 19 '16 at 11:52
  • I have Spring app and Couchbase running on different machines and yes hosts are configured correctly, I just connect to one IP and it works most of the time. It is just that once in every few runs I get timeouts which could possibly be due to connectivity drop. If I was directly using java client I could have possibly caught the time out exception, sleep the Thread and try again for connection but that is not the case with Spring hence this particular issue. I will give a try with old client and update the status here. – Anuj Bhatnagar Feb 19 '16 at 12:32