Uploaded image for project: 'Lucene - Core'
  1. Lucene - Core
  2. LUCENE-7002

MultiCollector throws NPE when there is CollectTerminatedException is thrown by a subcollector

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 5.4
    • 5.4.2, 5.5
    • core/search
    • None
    • New

    Description

      I am seeing this in our log:

      Caused by: java.lang.NullPointerException
              at org.apache.lucene.search.MultiCollector$MultiLeafCollector.setScorer(MultiCollector.java:156)
              at org.apache.lucene.search.BooleanScorer$1$1.setScorer(BooleanScorer.java:50)
              at org.apache.lucene.search.Weight$DefaultBulkScorer.score(Weight.java:166)
              at org.apache.lucene.search.BooleanScorer$1.score(BooleanScorer.java:59)
              at org.apache.lucene.search.BooleanScorer$BulkScorerAndDoc.score(BooleanScorer.java:90)
              at org.apache.lucene.search.BooleanScorer.scoreWindowSingleScorer(BooleanScorer.java:313)
              at org.apache.lucene.search.BooleanScorer.scoreWindow(BooleanScorer.java:336)
              at org.apache.lucene.search.BooleanScorer.score(BooleanScorer.java:364)
              at org.apache.lucene.search.BulkScorer.score(BulkScorer.java:39)
              at org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:821)
              at org.apache.lucene.search.IndexSearcher$5.call(IndexSearcher.java:763)
              at org.apache.lucene.search.IndexSearcher$5.call(IndexSearcher.java:760)
              at java.util.concurrent.FutureTask.run(FutureTask.java:266)
      

      Looks like

      MultiCollector.removeCollector(i)
      

      is called on line 176, the loop:

      for (LeafCollector c : collectors) {
              c.setScorer(scorer);
      }
      

      in setScorer can still step on it, on line 155.

      I am however, unable to reproduce that with a unit test.

      I made a copy of this class and added a null check in setScorer() and the problem goes away.

      Attachments

        1. LUCENE-7002.patch
          4 kB
          Adrien Grand

        Activity

          People

            jpountz Adrien Grand
            john.wang@gmail.com John Wang
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: