TimeoutException in CouchbaseBucket.get. Please help !

My code is like this:

public static void main(String[] args) throws Exception {
		List<Transcoder<? extends Document,?>> transcoders = new ArrayList<Transcoder<? extends Document, ?>>();
		transcoders.add(new RawTranscoder());
		
		CouchbaseEnvironment env = DefaultCouchbaseEnvironment.builder()
				.connectTimeout(60000)
				.kvTimeout(30000) 
		        .build();
		
		Cluster cluster = CouchbaseCluster.create(env,newHost);
		Bucket bucket = cluster.openBucket(bucketName,"",transcoders);
		testNewCouchbase(bucket);
	}
	
	public static void testNewCouchbase(final Bucket bucket) throws Exception {		
		String key = "1022081080102468052";
		
		BinaryDocument res = bucket.get(BinaryDocument.create(key));
		byte[] data = new byte[res.content().capacity()];
		for (int i = 0; i < res.content().capacity(); ++i) {
        	     data[i] = res.content().getByte(i);
                }
		System.out.println(data.length);
}

No matter how i change the kvtimeout and connectiontimeout, the following exception always happens:

Please help. Thanks

I havn’t tried much bigger timeout, and it seems not the core of problem

FYI: the sdk version i used is 2.3.2

Just once in a while, I can get the data with no exception.
But most of time, TimeoutException occurr

OMG. The problem is solved finally.
The reason is that the ip of every node in this couchbase cluster was merged into one domain name by a maintenance engineer. When connecting to cluster, different ip was reversed to the same domain, which may result in the confusion of bucket configurations, I guess.

One workaround of this is to modify system’s hosts file, to prevent DNS reversion

ah glad you found the issue so quickly, I was starting to look into it :wink: