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

NullPointerException in count and search with preference set to _primary #2896

Closed
dobe opened this Issue Apr 15, 2013 · 7 comments

Comments

Projects
None yet
2 participants
@dobe

dobe commented Apr 15, 2013

version 0.90 RC2

steps to reproduce:

start 2 nodes
create an index with shards on both nodes
stop 1 node, so that the index state is red

issue a _count or a _search request like this:

curl -XGET $idx_url'/_count?pretty=1&preference=_primary'

curl -XGET $idx_url'/_search?pretty=1&preference=_primary' -d '{
"query":{
"match_all":{}
 }
 }
'

the result for both is

{
  "error" : "NullPointerException[null]",
  "status" : 500
}

@ghost ghost assigned s1monw Apr 16, 2013

@s1monw

This comment has been minimized.

Show comment
Hide comment
@s1monw

s1monw Apr 16, 2013

Contributor

hey,

can you provide a full recreation of this failure. I tried to reproduce it in a testcase but never see the NPE

simon

Contributor

s1monw commented Apr 16, 2013

hey,

can you provide a full recreation of this failure. I tried to reproduce it in a testcase but never see the NPE

simon

@s1monw

This comment has been minimized.

Show comment
Hide comment
@s1monw

s1monw Apr 16, 2013

Contributor

hmm this preproduces with the REST api but not with the internal API... I will dig

Contributor

s1monw commented Apr 16, 2013

hmm this preproduces with the REST api but not with the internal API... I will dig

@dobe

This comment has been minimized.

Show comment
Hide comment
@dobe

dobe Apr 16, 2013

hi,
i just figured out that the nullpointer happens in https://github.com/elasticsearch/elasticsearch/blob/master/src/main/java/org/elasticsearch/action/support/broadcast/TransportBroadcastOperationAction.java

line 196::

 if (shard.currentNodeId().equals(nodes.localNodeId())) {

currentNodeId of shard is null in this case because the node is not there
i am not sure if the shard should not be in the iterator at this point or if it is ok to just check if currentnodeid is null

dobe commented Apr 16, 2013

hi,
i just figured out that the nullpointer happens in https://github.com/elasticsearch/elasticsearch/blob/master/src/main/java/org/elasticsearch/action/support/broadcast/TransportBroadcastOperationAction.java

line 196::

 if (shard.currentNodeId().equals(nodes.localNodeId())) {

currentNodeId of shard is null in this case because the node is not there
i am not sure if the shard should not be in the iterator at this point or if it is ok to just check if currentnodeid is null

@s1monw

This comment has been minimized.

Show comment
Hide comment
@s1monw

s1monw Apr 16, 2013

Contributor

yeah that's right. I am trying to figure out if this is a bigger problem or not...

Contributor

s1monw commented Apr 16, 2013

yeah that's right. I am trying to figure out if this is a bigger problem or not...

@s1monw

This comment has been minimized.

Show comment
Hide comment
@s1monw

s1monw Apr 16, 2013

Contributor

I just tested this with 0.20 branch and it has the same issue while only for _search since _count doesn't respect the preference setting here?

Contributor

s1monw commented Apr 16, 2013

I just tested this with 0.20 branch and it has the same issue while only for _search since _count doesn't respect the preference setting here?

s1monw added a commit to s1monw/elasticsearch that referenced this issue Apr 16, 2013

@s1monw s1monw closed this in efc9e8f Apr 16, 2013

@s1monw

This comment has been minimized.

Show comment
Hide comment
@s1monw

s1monw Apr 16, 2013

Contributor

thanks @dobe for reporting this. I'd be curious how you ran into this, didn't this happen on 0.20 as well?

Contributor

s1monw commented Apr 16, 2013

thanks @dobe for reporting this. I'd be curious how you ran into this, didn't this happen on 0.20 as well?

@dobe

This comment has been minimized.

Show comment
Hide comment
@dobe

dobe Apr 17, 2013

thanks for fixing it. we've set "_primary" as the default in a new plugin we are writing (targeting 0.90). so i was hunting the bug in our plugin code for two days until i found out it was happening on _count and _search too :)

dobe commented Apr 17, 2013

thanks for fixing it. we've set "_primary" as the default in a new plugin we are writing (targeting 0.90). so i was hunting the bug in our plugin code for two days until i found out it was happening on _count and _search too :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment