IndexOutOfBoundsException in DefaultCouchbaseBucketConfig.nodeIndexForMaster, flushing not possible afterwards

After creating and opening a bucket programmatically with 2.2.4 I get hundreds of those exceptions:

WARN  2016-02-16T11:53:18,777 Slf4JLogger.warn (l. 166): Exception while Handling Request Events RequestEvent{request=null}
java.lang.IndexOutOfBoundsException: Index: 10989, Size: 0
    at java.util.ArrayList.rangeCheck( ~[?:1.8.0_66]
    at java.util.ArrayList.get( ~[?:1.8.0_66]
    at com.couchbase.client.core.config.DefaultCouchbaseBucketConfig.nodeIndexForMaster( ~[core-io-1.2.4.jar:?]
    at com.couchbase.client.core.node.locate.KeyValueLocator.calculateNodeId( ~[core-io-1.2.4.jar:?]
    at com.couchbase.client.core.node.locate.KeyValueLocator.locateForCouchbaseBucket( ~[core-io-1.2.4.jar:?]
    at com.couchbase.client.core.node.locate.KeyValueLocator.locate( ~[core-io-1.2.4.jar:?]
    at com.couchbase.client.core.RequestHandler.onEvent( ~[core-io-1.2.4.jar:?]
    at com.couchbase.client.core.RequestHandler.onEvent( ~[core-io-1.2.4.jar:?]
    at [core-io-1.2.4.jar:?]
    at java.util.concurrent.ThreadPoolExecutor.runWorker( [?:1.8.0_66]
    at java.util.concurrent.ThreadPoolExecutor$ [?:1.8.0_66]
    at$ [core-io-1.2.4.jar:?]
    at [?:1.8.0_66]

They vary in the “Index” value of the IndexOutOfBoundsException.
The code does not progress after this.

Flushing any bucket is not possible afterwards. Doing it programmatically will result in “HTTP 503”. We had to rebalance the whole cluster node by node in order to get it flushing again. But after running the code again, the symptoms reappeared.

The server is 4.0.0-4051. It does not matter if I use Java SDK 2.2.3. This issue suddenly appeared after having worked for a year before and 1 month on the CB4 cluster.

Hi @SebastianF thanks for reporting. So are you saying this also happens with 2.2.3?

Is there any chance you can enable TRACE logging and send the log over somehow?
Do you have an example to reproduce it?

The weird part here is that the index should not be higher than 1023 in the first place since we don’t have more partitions. Do you happen to know at which operation this happens and/or in which phase of the client (bootstrap?)


Please see the attached file for a trace log.
I managed to minimize the example a bit.
The whole thing happens within a test suite. Those loads of exceptions I wrote about above originate from a flush call right in the beginning, this was unnecessary. I removed the call and only ran one test from the suite. Then I only get the IndexOutOfBoundsException once in the beginning. The test starts but any database operation leads to a timeout, failing the test.

Furthermore I tried connecting to a Couchbase 3 cluster which resulted in “Requests cancelled in-flight” and strangely an AuthentificationException after it had already connected. (9.3 KB)

We create the bucket like:

DefaultCouchbaseEnvironment.Builder settings = DefaultCouchbaseEnvironment.builder();
couchbaseDb = CouchbaseCluster.create(, "", "", "");