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

AssertionError during percolation using constant score query #5049

Closed
imotov opened this issue Feb 7, 2014 · 0 comments · Fixed by #5070
Closed

AssertionError during percolation using constant score query #5049

imotov opened this issue Feb 7, 2014 · 0 comments · Fixed by #5070

Comments

@imotov
Copy link
Contributor

imotov commented Feb 7, 2014

When elasticsearch is running with assertions enabled, a constant score query that doesn't match a record can cause AssertionError to be thrown. To reproduce start elasticsearch with assertions enabled and execute the following script

on 0.90 branch:

curl -XDELETE localhost:9200/test-idx
curl -XPUT 'localhost:9200/test-idx/'
curl -XPUT 'localhost:9200/_percolator/test-idx/1' -d '{
    "query" : {
        "constant_score":{
            "filter": {
                "and": [{
                    "query": {
                        "query_string" : {
                            "query" : "root"
                        }
                    }
                }, {
                    "term" : {
                        "message" : "tree"
                    }
                }]
            }
        }
    }
}'
curl -XGET 'localhost:9200/test-idx/message/_percolate' -d '{
    "doc" : {
        "message" : "A new bonsai tree in the office"
    }
}'

to reproduce on master:

curl -XDELETE localhost:9200/test-idx
curl -XPUT 'localhost:9200/test-idx/.percolator/1' -d '{
    "query" : {
        "constant_score":{
            "filter": {
                "and": [{
                    "query": {
                        "query_string" : {
                            "query" : "root"
                        }
                    }
                }, {
                    "term" : {
                        "message" : "tree"
                    }
                }]
            }
        }
    }
}'
curl -XGET 'localhost:9200/test-idx/message/_percolate' -d '{
    "doc" : {
        "message" : "A new bonsai tree in the office"
    }
}'

On the master the issue is not as prominent since the error is not returned to the user. On the current master the result of execution of the script above is the following error in the log:

[2014-02-07 10:49:32,594][WARN ][percolator               ] [Blizzard II] [[31]] failed to execute query
java.lang.AssertionError
    at org.apache.lucene.search.Scorer.score(Scorer.java:61)
    at org.apache.lucene.search.ConstantScoreQuery$ConstantScorer.score(ConstantScoreQuery.java:256)
    at org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:621)
    at org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:309)
    at org.elasticsearch.percolator.PercolatorService$4.doPercolate(PercolatorService.java:543)
    at org.elasticsearch.percolator.PercolatorService.percolate(PercolatorService.java:232)
    at org.elasticsearch.action.percolate.TransportPercolateAction.shardOperation(TransportPercolateAction.java:194)
    at org.elasticsearch.action.percolate.TransportPercolateAction.shardOperation(TransportPercolateAction.java:55)
    at org.elasticsearch.action.support.broadcast.TransportBroadcastOperationAction$AsyncBroadcastAction$2.run(TransportBroadcastOperationAction.java:226)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:724)
imotov added a commit to imotov/elasticsearch that referenced this issue Feb 7, 2014
Test for elastic#5049, the test doesn't fail but it generates AssertError in the log while running
s1monw added a commit that referenced this issue Feb 10, 2014
AndDocIdSet#IteratorBasedIterator was potentially initialized with
NO_MORE_DOCS which violates the initial state of DocIdSetIterator and
could lead to undefined behavior when used in a search context.

Closes #5049
s1monw added a commit that referenced this issue Feb 10, 2014
AndDocIdSet#IteratorBasedIterator was potentially initialized with
NO_MORE_DOCS which violates the initial state of DocIdSetIterator and
could lead to undefined behavior when used in a search context.

Closes #5049
@s1monw s1monw closed this as completed in 06f8a2e Feb 10, 2014
s1monw added a commit that referenced this issue Feb 10, 2014
AndDocIdSet#IteratorBasedIterator was potentially initialized with
NO_MORE_DOCS which violates the initial state of DocIdSetIterator and
could lead to undefined behavior when used in a search context.

Closes #5049
@s1monw s1monw self-assigned this Feb 10, 2014
mute pushed a commit to mute/elasticsearch that referenced this issue Jul 29, 2015
AndDocIdSet#IteratorBasedIterator was potentially initialized with
NO_MORE_DOCS which violates the initial state of DocIdSetIterator and
could lead to undefined behavior when used in a search context.

Closes elastic#5049
mute pushed a commit to mute/elasticsearch that referenced this issue Jul 29, 2015
AndDocIdSet#IteratorBasedIterator was potentially initialized with
NO_MORE_DOCS which violates the initial state of DocIdSetIterator and
could lead to undefined behavior when used in a search context.

Closes elastic#5049
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants