Skip to content

Apache Lucene open-source search software

SOLR-5451: SyncStrategy closes it's http connection manager before the executor that uses it in it's close method.

Mark Robert Millerf43a661898ec
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index a1a18abf7bf..b2bb52a48a0 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -101,6 +101,9 @@ Bug Fixes
* SOLR-4612: Admin UI - Analysis Screen contains empty table-columns (steffkes)
+* SOLR-5451: SyncStrategy closes it's http connection manager before the
+ executor that uses it in it's close method. (Mark Miller)
+
Other Changes
---------------------
diff --git a/solr/core/src/java/org/apache/solr/cloud/SyncStrategy.java b/solr/core/src/java/org/apache/solr/cloud/SyncStrategy.java
index 8249d2732e8..7ab219ec38a 100644
--- a/solr/core/src/java/org/apache/solr/cloud/SyncStrategy.java
+++ b/solr/core/src/java/org/apache/solr/cloud/SyncStrategy.java
@@ -258,12 +258,14 @@ public class SyncStrategy {
public void close() {
this.isClosed = true;
try {
- client.getConnectionManager().shutdown();
+ ExecutorUtil.shutdownAndAwaitTermination(recoveryCmdExecutor);
} catch (Throwable e) {
SolrException.log(log, e);
}
+
+ // we must close connection manager *after* shutting down executor
try {
- ExecutorUtil.shutdownNowAndAwaitTermination(recoveryCmdExecutor);
+ client.getConnectionManager().shutdown();
} catch (Throwable e) {
SolrException.log(log, e);
}
diff --git a/solr/solrj/src/java/org/apache/solr/common/util/ExecutorUtil.java b/solr/solrj/src/java/org/apache/solr/common/util/ExecutorUtil.java
index 777e32353ba..0c058c94af4 100644
--- a/solr/solrj/src/java/org/apache/solr/common/util/ExecutorUtil.java
+++ b/solr/solrj/src/java/org/apache/solr/common/util/ExecutorUtil.java
@@ -51,7 +51,7 @@ public class ExecutorUtil {
while (!shutdown) {
try {
// Wait a while for existing tasks to terminate
- shutdown = pool.awaitTermination(30, TimeUnit.SECONDS);
+ shutdown = pool.awaitTermination(60, TimeUnit.SECONDS);
} catch (InterruptedException ie) {
// Preserve interrupt status
Thread.currentThread().interrupt();