Navigation Menu

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IndexShardRoutingTable might barf if it has handled lots of searches... #5559

Closed
s1monw opened this issue Mar 26, 2014 · 0 comments
Closed

Comments

@s1monw
Copy link
Contributor

s1monw commented Mar 26, 2014

A user reported this on the ML:
https://groups.google.com/forum/?fromgroups=#!topic/elasticsearch/AxRU1UQP24U

Caused by: java.lang.IndexOutOfBoundsException: index (-2) must not be negative
        at org.elasticsearch.common.base.Preconditions.checkElementIndex(Preconditions.java:306)
        at org.elasticsearch.common.base.Preconditions.checkElementIndex(Preconditions.java:285)
        at org.elasticsearch.common.collect.RegularImmutableList.get(RegularImmutableList.java:65)
        at org.elasticsearch.cluster.routing.IndexShardRoutingTable.preferNodeActiveInitializingShardsIt(IndexShardRoutingTable.java:378)
        at org.elasticsearch.cluster.routing.operation.plain.PlainOperationRouting.preferenceActiveShardIterator(PlainOperationRouting.java:210)
        at org.elasticsearch.cluster.routing.operation.plain.PlainOperationRouting.getShards(PlainOperationRouting.java:80)
        at org.elasticsearch.action.get.TransportGetAction.shards(TransportGetAction.java:80)
        at org.elasticsearch.action.get.TransportGetAction.shards(TransportGetAction.java:42)
        at org.elasticsearch.action.support.single.shard.TransportShardSingleOperationAction$AsyncSingleAction.<init>(TransportShardSingleOperationAction.java:121)
        at org.elasticsearch.action.support.single.shard.TransportShardSingleOperationAction$AsyncSingleAction.<init>(TransportShardSingleOperationAction.java:97)
        at org.elasticsearch.action.support.single.shard.TransportShardSingleOperationAction.doExecute(TransportShardSingleOperationAction.java:74)
        at org.elasticsearch.action.support.single.shard.TransportShardSingleOperationAction.doExecute(TransportShardSingleOperationAction.java:49)
        at org.elasticsearch.action.support.TransportAction.execute(TransportAction.java:63)
        at org.elasticsearch.action.support.TransportAction.execute(TransportAction.java:49)
        at org.elasticsearch.client.node.NodeClient.execute(NodeClient.java:85)
        at org.elasticsearch.client.support.AbstractClient.get(AbstractClient.java:174)
        ... 9 more

the code that causes this is:

  private int pickIndex() {
        return Math.abs(counter.incrementAndGet());
  }

which might return a negative number. Math.abs() returns -1 for Integer.MIN_VALUE which causes the AIOOB mentioned above. The usage of this method seems to be pretty broken along those lines and we might need to think about fixing this generally...

@s1monw s1monw added bug and removed v0.90.13 labels Mar 26, 2014
@jpountz jpountz self-assigned this Mar 26, 2014
jpountz added a commit to jpountz/elasticsearch that referenced this issue Mar 26, 2014
jpountz added a commit that referenced this issue Mar 27, 2014
jpountz added a commit that referenced this issue Mar 27, 2014
jpountz added a commit that referenced this issue Mar 27, 2014
jpountz added a commit that referenced this issue Mar 27, 2014
mute pushed a commit to mute/elasticsearch that referenced this issue Jul 29, 2015
mute pushed a commit to mute/elasticsearch that referenced this issue Jul 29, 2015
mute pushed a commit to mute/elasticsearch that referenced this issue Jul 29, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants