SOLR-7956: There are interrupts on shutdown in places that can cause ChannelAlreadyClosed exceptions which prevents proper closing of transaction logs, interfere with the IndexWriter, the hdfs client and other things.

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1700177 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Mark Robert Miller 2015-08-30 23:44:31 +00:00
parent f7dc8767bb
commit a956d3ffe2
7 changed files with 18 additions and 19 deletions

View File

@ -45,7 +45,7 @@ Upgrading from Solr 5.x
* SolrClient.shutdown() has been removed, use SolrClient.close() instead.
* The deprecated zkCredientialsProvider element in solrcloud section of solr.xml
is now removed. Use the correct spelling (zkCredentialsProvider) instead.
is now removed. Use tI'll start looking at it today. - Mark On Wed, Aug 19, 2015 at 10:15 PM Gregory Chanan <he correct spelling (zkCredentialsProvider) instead.
* SOLR-7957: internal/expert - ResultContext was significantly changed and expanded
to allow for multiple full query results (DocLists) per Solr request.
@ -77,7 +77,7 @@ Other Changes
* SOLR-6954: Deprecated SolrClient.shutdown() method removed (Alan Woodward)
* SOLR-7355: Switch from Google's ConcurrentLinkedHashMap to Caffeine. Only
affects HDFS support. (Ben Manes via Shawn Heisey)
affects HDFS support. (Ben Manes viI'll start looking at it today. - Mark On Wed, Aug 19, 2015 at 10:15 PM Gregory Chanan <a Shawn Heisey)
* SOLR-7624: Remove deprecated zkCredientialsProvider element in solrcloud section of solr.xml.
(Xu Zhang, Per Steffensen, Ramkumar Aiyengar, Mark Miller)
@ -162,7 +162,8 @@ Bug Fixes
* SOLR-7949: Resolve XSS issue in Admin UI stats page (David Chiu via janhoy)
* SOLR-7956: There are interrupts on shutdown in places that can cause ChannelAlreadyClosed
exceptions which prevents proper closing of transaction logs. (Mark Miller)
exceptions which prevents proper closing of transaction logs, interfere with the IndexWriter,
the hdfs client and other things. (Mark Miller, Scott Blum)
* SOLR-7972: Fix VelocityResponseWriter template encoding issue.
Templates must be UTF-8 encoded. (Erik Hatcher)

View File

@ -486,7 +486,7 @@ public class CoreContainer {
}
}
} finally {
ExecutorUtil.shutdownNowAndAwaitTermination(coreLoadExecutor);
ExecutorUtil.shutdownAndAwaitTermination(coreLoadExecutor);
}
}
};

View File

@ -41,6 +41,7 @@ import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.locks.ReentrantLock;
@ -116,6 +117,8 @@ public class ReplicationHandler extends RequestHandlerBase implements SolrCoreAw
private static final Logger LOG = LoggerFactory.getLogger(ReplicationHandler.class.getName());
SolrCore core;
private volatile boolean closed = false;
private static final class CommitVersionInfo {
public final long version;
@ -1214,16 +1217,11 @@ public class ReplicationHandler extends RequestHandlerBase implements SolrCoreAw
@Override
public void preClose(SolrCore core) {
try {
if (executorService != null) executorService.shutdown();
if (executorService != null) executorService.shutdown(); // we don't wait for shutdown - this can deadlock core reload
} finally {
try {
if (pollingIndexFetcher != null) {
pollingIndexFetcher.destroy();
}
} finally {
if (executorService != null) ExecutorUtil
.shutdownNowAndAwaitTermination(executorService);
}
}
if (currentIndexFetcher != null && currentIndexFetcher != pollingIndexFetcher) {
currentIndexFetcher.destroy();
@ -1237,9 +1235,9 @@ public class ReplicationHandler extends RequestHandlerBase implements SolrCoreAw
core.addCloseHook(new CloseHook() {
@Override
public void preClose(SolrCore core) {
ExecutorUtil.shutdownNowAndAwaitTermination(restoreExecutor);
ExecutorUtil.shutdownAndAwaitTermination(restoreExecutor);
if (restoreFuture != null) {
restoreFuture.cancel(true);
restoreFuture.cancel(false);
}
}

View File

@ -317,9 +317,7 @@ public class HttpShardHandler extends ShardHandler {
@Override
public void cancelAll() {
for (Future<ShardResponse> future : pending) {
// TODO: any issues with interrupting? shouldn't be if
// there are finally blocks to release connections.
future.cancel(true);
future.cancel(false);
}
}

View File

@ -89,7 +89,7 @@ public final class CommitTracker implements Runnable {
public synchronized void close() {
if (pending != null) {
pending.cancel(true);
pending.cancel(false);
pending = null;
}
scheduler.shutdownNow();

View File

@ -906,7 +906,7 @@ public class UpdateLog implements PluginInfoInitialized {
}
try {
ExecutorUtil.shutdownNowAndAwaitTermination(recoveryExecutor);
ExecutorUtil.shutdownAndAwaitTermination(recoveryExecutor);
} catch (Exception e) {
SolrException.log(log, e);
}

View File

@ -78,8 +78,10 @@ public class ExecutorUtil {
public void clean(AtomicReference<?> ctx);
}
// this will interrupt the threads! Lucene and Solr do not like this because it can close channels, so only use
// this if you know what you are doing - you probably want shutdownAndAwaitTermination
// ** This will interrupt the threads! ** Lucene and Solr do not like this because it can close channels, so only use
// this if you know what you are doing - you probably want shutdownAndAwaitTermination.
// Marked as Deprecated to discourage use.
@Deprecated
public static void shutdownNowAndAwaitTermination(ExecutorService pool) {
pool.shutdown(); // Disable new tasks from being submitted
pool.shutdownNow(); // Cancel currently executing tasks - NOTE: this interrupts!