SOLR-10063: CoreContainer shutdown has race condition that can cause a hang on shutdown.

This commit is contained in:
markrmiller 2017-02-11 17:08:32 -05:00
parent 2196663156
commit 5b976959d9
2 changed files with 12 additions and 1 deletions

View File

@ -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-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 Optimizations
---------------------- ----------------------

View File

@ -679,7 +679,16 @@ public class CoreContainer {
} }
if (backgroundCloser != null) { // Doesn't seem right, but tests get in here without initializing the core. if (backgroundCloser != null) { // Doesn't seem right, but tests get in here without initializing the core.
try { 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) { } catch (InterruptedException e) {
Thread.currentThread().interrupt(); Thread.currentThread().interrupt();
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {