You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ma...@apache.org on 2015/08/31 01:57:31 UTC

svn commit: r1700179 - in /lucene/dev/branches/branch_5x: ./ solr/ solr/core/ solr/core/src/java/org/apache/solr/core/ solr/core/src/java/org/apache/solr/handler/ solr/core/src/java/org/apache/solr/handler/component/ solr/core/src/java/org/apache/solr/...

Author: markrmiller
Date: Sun Aug 30 23:57:31 2015
New Revision: 1700179

URL: http://svn.apache.org/r1700179
Log:
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.

Modified:
    lucene/dev/branches/branch_5x/   (props changed)
    lucene/dev/branches/branch_5x/solr/   (props changed)
    lucene/dev/branches/branch_5x/solr/CHANGES.txt   (contents, props changed)
    lucene/dev/branches/branch_5x/solr/core/   (props changed)
    lucene/dev/branches/branch_5x/solr/core/src/java/org/apache/solr/core/CoreContainer.java
    lucene/dev/branches/branch_5x/solr/core/src/java/org/apache/solr/handler/ReplicationHandler.java
    lucene/dev/branches/branch_5x/solr/core/src/java/org/apache/solr/handler/component/HttpShardHandler.java
    lucene/dev/branches/branch_5x/solr/core/src/java/org/apache/solr/update/CommitTracker.java
    lucene/dev/branches/branch_5x/solr/core/src/java/org/apache/solr/update/UpdateLog.java
    lucene/dev/branches/branch_5x/solr/solrj/   (props changed)
    lucene/dev/branches/branch_5x/solr/solrj/src/java/org/apache/solr/common/util/ExecutorUtil.java

Modified: lucene/dev/branches/branch_5x/solr/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/solr/CHANGES.txt?rev=1700179&r1=1700178&r2=1700179&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/solr/CHANGES.txt (original)
+++ lucene/dev/branches/branch_5x/solr/CHANGES.txt Sun Aug 30 23:57:31 2015
@@ -79,7 +79,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)

Modified: lucene/dev/branches/branch_5x/solr/core/src/java/org/apache/solr/core/CoreContainer.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/solr/core/src/java/org/apache/solr/core/CoreContainer.java?rev=1700179&r1=1700178&r2=1700179&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/solr/core/src/java/org/apache/solr/core/CoreContainer.java (original)
+++ lucene/dev/branches/branch_5x/solr/core/src/java/org/apache/solr/core/CoreContainer.java Sun Aug 30 23:57:31 2015
@@ -486,7 +486,7 @@ public class CoreContainer {
                 }
               }
             } finally {
-              ExecutorUtil.shutdownNowAndAwaitTermination(coreLoadExecutor);
+              ExecutorUtil.shutdownAndAwaitTermination(coreLoadExecutor);
             }
           }
         };

Modified: lucene/dev/branches/branch_5x/solr/core/src/java/org/apache/solr/handler/ReplicationHandler.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/solr/core/src/java/org/apache/solr/handler/ReplicationHandler.java?rev=1700179&r1=1700178&r2=1700179&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/solr/core/src/java/org/apache/solr/handler/ReplicationHandler.java (original)
+++ lucene/dev/branches/branch_5x/solr/core/src/java/org/apache/solr/handler/ReplicationHandler.java Sun Aug 30 23:57:31 2015
@@ -41,6 +41,7 @@ import java.util.concurrent.ExecutorServ
 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;
@@ -115,6 +116,8 @@ public class ReplicationHandler extends
 
   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;
@@ -1202,16 +1205,11 @@ public class ReplicationHandler extends
       @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();
@@ -1225,9 +1223,9 @@ public class ReplicationHandler extends
     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);
         }
       }
 

Modified: lucene/dev/branches/branch_5x/solr/core/src/java/org/apache/solr/handler/component/HttpShardHandler.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/solr/core/src/java/org/apache/solr/handler/component/HttpShardHandler.java?rev=1700179&r1=1700178&r2=1700179&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/solr/core/src/java/org/apache/solr/handler/component/HttpShardHandler.java (original)
+++ lucene/dev/branches/branch_5x/solr/core/src/java/org/apache/solr/handler/component/HttpShardHandler.java Sun Aug 30 23:57:31 2015
@@ -317,9 +317,7 @@ public class HttpShardHandler extends Sh
   @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);
     }
   }
 

Modified: lucene/dev/branches/branch_5x/solr/core/src/java/org/apache/solr/update/CommitTracker.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/solr/core/src/java/org/apache/solr/update/CommitTracker.java?rev=1700179&r1=1700178&r2=1700179&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/solr/core/src/java/org/apache/solr/update/CommitTracker.java (original)
+++ lucene/dev/branches/branch_5x/solr/core/src/java/org/apache/solr/update/CommitTracker.java Sun Aug 30 23:57:31 2015
@@ -89,7 +89,7 @@ public final class CommitTracker impleme
   
   public synchronized void close() {
     if (pending != null) {
-      pending.cancel(true);
+      pending.cancel(false);
       pending = null;
     }
     scheduler.shutdownNow();

Modified: lucene/dev/branches/branch_5x/solr/core/src/java/org/apache/solr/update/UpdateLog.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/solr/core/src/java/org/apache/solr/update/UpdateLog.java?rev=1700179&r1=1700178&r2=1700179&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/solr/core/src/java/org/apache/solr/update/UpdateLog.java (original)
+++ lucene/dev/branches/branch_5x/solr/core/src/java/org/apache/solr/update/UpdateLog.java Sun Aug 30 23:57:31 2015
@@ -902,7 +902,7 @@ public class UpdateLog implements Plugin
       }
 
       try {
-        ExecutorUtil.shutdownNowAndAwaitTermination(recoveryExecutor);
+        ExecutorUtil.shutdownAndAwaitTermination(recoveryExecutor);
       } catch (Exception e) {
         SolrException.log(log, e);
       }

Modified: lucene/dev/branches/branch_5x/solr/solrj/src/java/org/apache/solr/common/util/ExecutorUtil.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/solr/solrj/src/java/org/apache/solr/common/util/ExecutorUtil.java?rev=1700179&r1=1700178&r2=1700179&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/solr/solrj/src/java/org/apache/solr/common/util/ExecutorUtil.java (original)
+++ lucene/dev/branches/branch_5x/solr/solrj/src/java/org/apache/solr/common/util/ExecutorUtil.java Sun Aug 30 23:57:31 2015
@@ -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!