You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@solr.apache.org by ds...@apache.org on 2022/04/20 04:13:20 UTC

[solr] branch main updated: SOLR-13044: Fix NPE in IndexFetcher.openNewSearcherAndUpdateCommitPoint (#794)

This is an automated email from the ASF dual-hosted git repository.

dsmiley pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/solr.git


The following commit(s) were added to refs/heads/main by this push:
     new 61df03f2f48 SOLR-13044: Fix NPE in IndexFetcher.openNewSearcherAndUpdateCommitPoint (#794)
61df03f2f48 is described below

commit 61df03f2f48985a7ba1c5754aaed6315a6a498e7
Author: David Smiley <ds...@salesforce.com>
AuthorDate: Wed Apr 20 00:13:15 2022 -0400

    SOLR-13044: Fix NPE in IndexFetcher.openNewSearcherAndUpdateCommitPoint (#794)
    
    Core might be closing.
---
 solr/CHANGES.txt                                             | 2 ++
 solr/core/src/java/org/apache/solr/handler/IndexFetcher.java | 7 ++++---
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index b00b14417b2..271956509e1 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -63,6 +63,8 @@ Bug Fixes
 * SOLR-15045: `DistributedZkUpdateProcessor` now issues commits to local shards and remote shards in parallel,
   halving the latency of synchronous commits (Michael Gibney)
 
+* SOLR-13044: Fix NPE during core close racing with index replication check.  (David Smiley, hossman)
+
 Other Changes
 ---------------------
 * SOLR-15897: Remove <jmx/> from all unit test solrconfig.xml files. (Eric Pugh)
diff --git a/solr/core/src/java/org/apache/solr/handler/IndexFetcher.java b/solr/core/src/java/org/apache/solr/handler/IndexFetcher.java
index 1fa3f2f8cd5..1b23b5b9dce 100644
--- a/solr/core/src/java/org/apache/solr/handler/IndexFetcher.java
+++ b/solr/core/src/java/org/apache/solr/handler/IndexFetcher.java
@@ -1014,8 +1014,10 @@ public class IndexFetcher {
     // 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 {
+    try (SolrCore core = solrCore.getCoreContainer().getCore(solrCore.getName())) {
+      if (core == null) {
+        return; // core closed, presumably
+      }
       @SuppressWarnings("unchecked")
       Future<Void>[] waitSearcher = (Future<Void>[]) Array.newInstance(Future.class, 1);
       searcher = core.getSearcher(true, true, waitSearcher, true);
@@ -1031,7 +1033,6 @@ public class IndexFetcher {
       if (searcher != null) {
         searcher.decref();
       }
-      core.close();
     }
 
     // update the commit point in replication handler