Apache Solr open-source search software
SOLR-13044: Fix NPE in IndexFetcher.openNewSearcherAndUpdateCommitPoint (#794)
David Smiley61df03f2f489
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txtindex 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.javaindex 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