Exception -- signalDisconnected, blocking, timeout

Hi all,

I am running the Java SDK from my Windows machine and trying to add/fetch JSON data from the Couchbase server which is on a Ubuntu 14.04 on a Google Compute Engine VM.

(Earlier I was getting an error for Timeout in which I could not create the bucket. After going through the forum I modified my code to create a custom Couchbase cluster and now I am able to create the bucket object.)

But now I am getting an exception.
Following is my code:

CouchbaseEnvironment env = DefaultCouchbaseEnvironment.builder()
//this set the IO socket timeout globally, to 45s
.socketConnectTimeout((int) TimeUnit.SECONDS.toMillis(45))
//this sets the connection timeout for openBucket calls globally (unless a particular call provides its own timeout)
.connectTimeout(TimeUnit.SECONDS.toMillis(60))
.build();
Cluster cluster = CouchbaseCluster.create(env,“104.155.176.50”,“107.167.190.181”);
Bucket bucket = cluster.openBucket(“hello_me”);

    		//bucket.get("21st_amendment_brewery_cafe-21a_ipa").content().get("name");
    		JsonDocument doc = JsonDocument.create("temp_ani", JsonObject.create().put("some", "value"));
    		System.out.println(bucket.insert(doc));

and following is the stack trace:

INFO: Opened bucket hello_me
Sep 12, 2016 4:48:27 PM com.couchbase.client.core.node.CouchbaseNode signalDisconnected
INFO: Disconnected from Node 50.176.155.104.bc.googleusercontent.com
Sep 12, 2016 4:48:27 PM com.couchbase.client.core.node.CouchbaseNode signalDisconnected
INFO: Disconnected from Node 181.190.167.107.bc.googleusercontent.com
Exception in thread “main” java.lang.RuntimeException: java.util.concurrent.TimeoutException
at com.couchbase.client.java.util.Blocking.blockForSingle(Blocking.java:71)
at com.couchbase.client.java.CouchbaseBucket.insert(CouchbaseBucket.java:312)
at com.couchbase.client.java.CouchbaseBucket.insert(CouchbaseBucket.java:307)
at com.kpit.ani.springdataCouchbase.App.main(App.java:46)
Caused by: java.util.concurrent.TimeoutException
… 4 more

The exception occurs when I try to run

    		System.out.println(bucket.insert(doc));

i.e. while inserting the data. What am I doing wrong?
Kindly suggest.
Note: There are two nodes for the cluster and I have provided access to the ports through the GCE firewall. I am novice to Couchbase, any help provided will be appreciated.

If you had to increase the timeouts for connection, I guess the latency between your client app and the two nodes in the cluster is high? If that’s the case, then you probably also need to fine tune the timeout for every operation category on the CouchbaseEnvironment.

There’s one for key/value operations like insert and get, named kvTimeout()

Hi Simon,

Can you please elaborate?
Or can you please provide URL to any example/tutorial?

The same way you set a connectTimeout on the CouchbaseEnvironment, you could try to set a kvTimeout to rule out the client-to-server latency as a root cause for your problem. See http://developer.couchbase.com/documentation/server/4.5/sdk/java/client-settings.html#story-h2-4

That said, the trace above may indicate that the connection to your cluster gets dropped before something has time to return…

Hey @simonbasle,

Thanks for your reply. You were correct, the issue was of timeout as the nodes were in different compute engines in different geographies. This was the reason for the latency.

The issue was resolved after I created the nodes in the same geography.

Thank you again.

1 Like

@aniket.khedekar

I am facing exactly same issue, my nodes are in AWS cloud - same geography. Tried setting up all 3 params - connectionTimeout, socketTimeOut as well as kvTimeout.

Still problem persists:

Sep 26, 2017 2:42:55 PM com.couchbase.client.core.CouchbaseCore
INFO: CouchbaseEnvironment: {sslEnabled=false, sslKeystoreFile=‘null’, sslKeystorePassword=‘null’, queryEnabled=false, queryPort=8093, bootstrapHttpEnabled=true, bootstrapCarrierEnabled=true, bootstrapHttpDirectPort=8091, bootstrapHttpSslPort=18091, bootstrapCarrierDirectPort=11210, bootstrapCarrierSslPort=11207, ioPoolSize=4, computationPoolSize=4, responseBufferSize=16384, requestBufferSize=16384, kvServiceEndpoints=1, viewServiceEndpoints=1, queryServiceEndpoints=1, searchServiceEndpoints=1, ioPool=NioEventLoopGroup, coreScheduler=CoreScheduler, eventBus=DefaultEventBus, packageNameAndVersion=couchbase-java-client/2.2.8 (git: 2.2.8, core: 1.2.9), dcpEnabled=false, retryStrategy=BestEffort, maxRequestLifetime=75000, retryDelay=ExponentialDelay{growBy 1.0 MICROSECONDS, powers of 2; lower=100, upper=100000}, reconnectDelay=ExponentialDelay{growBy 1.0 MILLISECONDS, powers of 2; lower=32, upper=4096}, observeIntervalDelay=ExponentialDelay{growBy 1.0 MICROSECONDS, powers of 2; lower=10, upper=100000}, keepAliveInterval=30000, autoreleaseAfter=2000, bufferPoolingEnabled=true, tcpNodelayEnabled=true, mutationTokensEnabled=false, socketConnectTimeout=50000, dcpConnectionBufferSize=20971520, dcpConnectionBufferAckThreshold=0.2, dcpConnectionName=dcp/core-io, callbacksOnIoPool=false, queryTimeout=75000, viewTimeout=75000, kvTimeout=10000, connectTimeout=50000, disconnectTimeout=25000, dnsSrvEnabled=false}
Sep 26, 2017 2:42:59 PM com.couchbase.client.core.node.CouchbaseNode signalConnected
INFO: Connected to Node ec2-54-183-207-37.us-west-1.compute.amazonaws.com
Sep 26, 2017 2:42:59 PM com.couchbase.client.core.node.CouchbaseNode signalConnected
INFO: Connected to Node ec2-13-56-229-101.us-west-1.compute.amazonaws.com
Sep 26, 2017 2:43:04 PM com.couchbase.client.core.node.CouchbaseNode
WARNING: DNS Reverse Lookup of 172.31.25.65 is slow, took 4500ms
Sep 26, 2017 2:43:08 PM com.couchbase.client.core.node.CouchbaseNode
WARNING: DNS Reverse Lookup of 172.31.27.0 is slow, took 4500ms
Sep 26, 2017 2:43:08 PM com.couchbase.client.core.config.DefaultConfigurationProvider$8 call
INFO: Opened bucket StellarA
Sep 26, 2017 2:43:08 PM com.couchbase.client.core.node.CouchbaseNode signalDisconnected
INFO: Disconnected from Node ec2-54-183-207-37.us-west-1.compute.amazonaws.com
Sep 26, 2017 2:43:08 PM com.couchbase.client.core.node.CouchbaseNode signalDisconnected
INFO: Disconnected from Node ec2-13-56-229-101.us-west-1.compute.amazonaws.com
java.lang.RuntimeException: java.util.concurrent.TimeoutException
at com.couchbase.client.java.util.Blocking.blockForSingle(Blocking.java:75)
at com.couchbase.client.java.CouchbaseBucket.insert(CouchbaseBucket.java:317)
at com.couchbase.client.java.CouchbaseBucket.insert(CouchbaseBucket.java:312)
at com.src.couchbase.Sample.main(Sample.java:33)
Caused by: java.util.concurrent.TimeoutException
… 4 more