diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt index 94846e3cdbe..ba6e57492ac 100644 --- a/solr/CHANGES.txt +++ b/solr/CHANGES.txt @@ -159,6 +159,8 @@ Bug Fixes * SOLR-10124: Replication can skip removing a temporary index directory in some cases when it should not. (Mark Miller) +* SOLR-10063: CoreContainer shutdown has race condition that can cause a hang on shutdown. (Mark Miller) + Optimizations ---------------------- diff --git a/solr/core/src/java/org/apache/solr/core/CoreContainer.java b/solr/core/src/java/org/apache/solr/core/CoreContainer.java index bbac3944e41..f7a8f33a6ca 100644 --- a/solr/core/src/java/org/apache/solr/core/CoreContainer.java +++ b/solr/core/src/java/org/apache/solr/core/CoreContainer.java @@ -679,7 +679,16 @@ public class CoreContainer { } if (backgroundCloser != null) { // Doesn't seem right, but tests get in here without initializing the core. try { - backgroundCloser.join(); + while (true) { + backgroundCloser.join(15000); + if (backgroundCloser.isAlive()) { + synchronized (solrCores.getModifyLock()) { + solrCores.getModifyLock().notifyAll(); // there is a race we have to protect against + } + } else { + break; + } + } } catch (InterruptedException e) { Thread.currentThread().interrupt(); if (log.isDebugEnabled()) {