Uploaded image for project: 'Solr'
  1. Solr
  2. SOLR-13044

IndexFetcher.openNewSearcherAndUpdateCommitPoint can throw NPE on null SolrCore

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 9.1
    • None
    • None

    Description

      While working through the logs in SOLR-13031, i observed the following...

        [beaster]   2> 57230 ERROR (indexFetcher-193-thread-1) [    ] o.a.s.h.ReplicationHandler Index fetch failed :org.apache.solr.common.SolrException: Index fetch failed : 
        [beaster]   2>        at org.apache.solr.handler.IndexFetcher.fetchLatestIndex(IndexFetcher.java:676)
        [beaster]   2>        at org.apache.solr.handler.IndexFetcher.fetchLatestIndex(IndexFetcher.java:346)
        [beaster]   2>        at org.apache.solr.handler.ReplicationHandler.doFetch(ReplicationHandler.java:424)
        [beaster]   2>        at org.apache.solr.handler.ReplicationHandler.lambda$setupPolling$13(ReplicationHandler.java:1184)
        [beaster]   2>        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
        [beaster]   2>        at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)
        [beaster]   2>        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180)
        [beaster]   2>        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)
        [beaster]   2>        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        [beaster]   2>        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        [beaster]   2>        at java.lang.Thread.run(Thread.java:748)
        [beaster]   2> Caused by: java.lang.NullPointerException
        [beaster]   2>        at org.apache.solr.handler.IndexFetcher.openNewSearcherAndUpdateCommitPoint(IndexFetcher.java:909)
        [beaster]   2>        at org.apache.solr.handler.IndexFetcher.fetchLatestIndex(IndexFetcher.java:653)
        [beaster]   2>        ... 10 more
      

      Which comes from this bit of code...

          // must get the latest solrCore object because the one we have might be closed because of a reload
          // todo stop keeping solrCore around
          SolrCore core = solrCore.getCoreContainer().getCore(solrCore.getName());
          try {
            Future[] waitSearcher = new Future[1];
            searcher = core.getSearcher(true, true, waitSearcher, true);
            if (waitSearcher[0] != null) {
              try {
                waitSearcher[0].get();
              } catch (InterruptedException | ExecutionException e) {
                SolrException.log(log, e);
              }
            }
            commitPoint = searcher.get().getIndexReader().getIndexCommit();
          } finally {
            if (searcher != null) {
              searcher.decref();
            }
            core.close(); // IndexFetcher.java:909 where NPE is being thrown
          }
      

      IIUC: openNewSearcherAndUpdateCommitPoint isn't accounting for the possibility that the the IndexFetcher is getting run before the SolrCore has been fully initialized and regsitere with the CoreContainer and/or after/while the SolrCore (and/or CoreContainer) is in the process of being closed, and isn't available from solrCore.getCoreContainer().getCore(String)

      Attachments

        Issue Links

          Activity

            People

              dsmiley David Smiley
              hossman Chris M. Hostetter
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 2h 20m
                  2h 20m