[JCBC-123] ArrayOutOfBounds exception during failover Created: 02/Oct/12  Updated: 03/Dec/12  Resolved: 09/Nov/12

Status: Resolved
Project: Couchbase Java Client
Component/s: None
Affects Version/s: 1.0.3
Fix Version/s: 1.1-beta
Security Level: Public

Type: Bug Priority: Major
Reporter: Mark Nunberg Assignee: Michael Nitschinger
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
is duplicated by JCBC-46 DefaultConfigFactory attempts to crea... Closed

While running a sequence of getsAsync operations, the entry point/bootstrap node is failed over. The output follows

Exception in thread "SDK Handle-8" java.lang.ArrayIndexOutOfBoundsException: -1
        at java.util.ArrayList.elementData(ArrayList.java:338)
        at java.util.ArrayList.get(ArrayList.java:351)
        at com.couchbase.client.vbucket.config.DefaultConfig.getServer(DefaultConfig.java:81)
        at com.couchbase.client.vbucket.VBucketNodeLocator.getPrimary(VBucketNodeLocator.java:74)
        at com.couchbase.client.CouchbaseConnection.addOperation(CouchbaseConnection.java:144)
        at net.spy.memcached.MemcachedConnection.enqueueOperation(MemcachedConnection.java:639)
        at net.spy.memcached.MemcachedClient.asyncGets(MemcachedClient.java:888)
        at net.spy.memcached.MemcachedClient.asyncGets(MemcachedClient.java:902)
        at com.couchbase.sdkd.cbclient.GetCommandContext.doOneCommand(GetCommandContext.java:60)
        at com.couchbase.sdkd.cbclient.CommandContext.execute(CommandContext.java:266)
        at com.couchbase.sdkd.server.SdkServer.executeCommand(SdkServer.java:114)
        at com.couchbase.sdkd.server.SdkServer.handleRequest(SdkServer.java:133)
        at com.couchbase.sdkd.server.SdkServer.run(SdkServer.java:187)

Comment by Matt Ingenthron [ 05/Oct/12 ]
This may fall into rewriting the configuration handling. I'll discuss this more with Michael as needed.
Comment by Michael Nitschinger [ 15/Oct/12 ]
Hey Mark,

can you check if this also happens against the dp3 release? I saw that the sdkd-java builds against the stable release.

Comment by Michael Nitschinger [ 08/Nov/12 ]
Tracked here: http://review.couchbase.org/#/c/22352/
Comment by Michael Nitschinger [ 09/Nov/12 ]
An exception is now raised, because a vbucket master of -1 means that no server is able to respond for the given key. This is a strong indication of data loss. This could be the case because no replica was defined and a node was failed over or more nodes have been failed over than replicas defined.

Either way, the client itself has no chance of dealing with the situation and therefore populates a controlled exception up to the caller.

The fix has been pushed to master and will be available in dp5.
Generated at Wed Oct 01 19:14:01 CDT 2014 using JIRA 5.2.4#845-sha1:c9f4cc41abe72fb236945343a1f485c2c844dac9.