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 2020/07/26 00:13:05 UTC

[lucene-solr] branch reference_impl updated (8f9c16d -> bf9c125d)

This is an automated email from the ASF dual-hosted git repository.

markrmiller pushed a change to branch reference_impl
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git.


 discard 8f9c16d  @330 Add a nightly.
 discard 4e1f930  @329 Tweaking threads in tests.
     new bf9c125d @329 Tweaking threads in tests.

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (8f9c16d)
            \
             N -- N -- N   refs/heads/reference_impl (bf9c125d)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 solr/server/resources/log4j2.xml | 1 -
 1 file changed, 1 deletion(-)


[lucene-solr] 01/01: @329 Tweaking threads in tests.

Posted by ma...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

markrmiller pushed a commit to branch reference_impl
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git

commit bf9c125d571f5c822a0a3d59b50a2f319179d0bb
Author: markrmiller@gmail.com <ma...@gmail.com>
AuthorDate: Sat Jul 25 19:12:35 2020 -0500

    @329 Tweaking threads in tests.
---
 .../src/java/org/apache/solr/cloud/Overseer.java   |  9 ++++
 .../org/apache/solr/cloud/ConfigSetsAPITest.java   |  2 +-
 .../OutOfBoxZkACLAndCredentialsProvidersTest.java  |  5 +-
 .../autoscaling/sim/TestSimNodeLostTrigger.java    |  2 +
 .../solr/handler/component/TermsComponentTest.java |  2 +
 .../src/java/org/apache/solr/common/ParWork.java   | 11 ++++-
 .../org/apache/solr/common/ParWorkExecutor.java    |  9 ++--
 .../solr/common/util/SolrQueuedThreadPool.java     |  2 +-
 .../org/apache/solr/SolrIgnoredThreadsFilter.java  | 43 -----------------
 .../src/java/org/apache/solr/SolrTestCase.java     | 23 +++++----
 .../java/org/apache/solr/cloud/ZkTestServer.java   | 54 ++++++++++++----------
 11 files changed, 77 insertions(+), 85 deletions(-)

diff --git a/solr/core/src/java/org/apache/solr/cloud/Overseer.java b/solr/core/src/java/org/apache/solr/cloud/Overseer.java
index 38a823b..ed66120 100644
--- a/solr/core/src/java/org/apache/solr/cloud/Overseer.java
+++ b/solr/core/src/java/org/apache/solr/cloud/Overseer.java
@@ -533,6 +533,15 @@ public class Overseer implements SolrCloseable {
     }
 
     @Override
+    public void run() {
+      try {
+        super.run();
+      } finally {
+        ParWork.closeExecutor();
+      }
+    }
+
+    @Override
     public void close() throws IOException {
       this.isClosed = true;
       thread.close();
diff --git a/solr/core/src/test/org/apache/solr/cloud/ConfigSetsAPITest.java b/solr/core/src/test/org/apache/solr/cloud/ConfigSetsAPITest.java
index 6655b25..ff1c715 100644
--- a/solr/core/src/test/org/apache/solr/cloud/ConfigSetsAPITest.java
+++ b/solr/core/src/test/org/apache/solr/cloud/ConfigSetsAPITest.java
@@ -16,6 +16,7 @@
  */
 package org.apache.solr.cloud;
 
+import com.carrotsearch.randomizedtesting.annotations.ThreadLeakLingering;
 import org.apache.solr.client.solrj.request.CollectionAdminRequest;
 import org.apache.solr.client.solrj.request.ConfigSetAdminRequest;
 import org.apache.solr.common.SolrException;
@@ -27,7 +28,6 @@ import org.junit.BeforeClass;
 import org.junit.Ignore;
 import org.junit.Test;
 
-@Ignore
 public class ConfigSetsAPITest extends SolrCloudTestCase {
 
   @BeforeClass
diff --git a/solr/core/src/test/org/apache/solr/cloud/OutOfBoxZkACLAndCredentialsProvidersTest.java b/solr/core/src/test/org/apache/solr/cloud/OutOfBoxZkACLAndCredentialsProvidersTest.java
index 9e69f8b..886cce0 100644
--- a/solr/core/src/test/org/apache/solr/cloud/OutOfBoxZkACLAndCredentialsProvidersTest.java
+++ b/solr/core/src/test/org/apache/solr/cloud/OutOfBoxZkACLAndCredentialsProvidersTest.java
@@ -92,15 +92,14 @@ public class OutOfBoxZkACLAndCredentialsProvidersTest extends SolrTestCaseJ4 {
   @Override
   public void tearDown() throws Exception {
     zkServer.shutdown();
-    
     super.tearDown();
   }
 
   @Test
   public void testOutOfBoxSolrZkClient() throws Exception {
     SolrZkClient zkClient = new SolrZkClient(zkServer.getZkAddress(), AbstractZkTestCase.TIMEOUT);
-    zkClient.start();
     try {
+      zkClient.start();
       VMParamsZkACLAndCredentialsProvidersTest.doTest(zkClient,
           true, true, true, true, true,
           true, true, true, true, true);
@@ -112,8 +111,8 @@ public class OutOfBoxZkACLAndCredentialsProvidersTest extends SolrTestCaseJ4 {
   @Test
   public void testOpenACLUnsafeAllover() throws Exception {
     SolrZkClient zkClient = new SolrZkClient(zkServer.getZkHost(), AbstractZkTestCase.TIMEOUT);
-    zkClient.start();
     try {
+      zkClient.start();
       List<String> verifiedList = new ArrayList<String>();
       assertOpenACLUnsafeAllover(zkClient, "/", verifiedList);
       assertTrue(verifiedList.contains("/solr"));
diff --git a/solr/core/src/test/org/apache/solr/cloud/autoscaling/sim/TestSimNodeLostTrigger.java b/solr/core/src/test/org/apache/solr/cloud/autoscaling/sim/TestSimNodeLostTrigger.java
index 8eb6156..abba3a3 100644
--- a/solr/core/src/test/org/apache/solr/cloud/autoscaling/sim/TestSimNodeLostTrigger.java
+++ b/solr/core/src/test/org/apache/solr/cloud/autoscaling/sim/TestSimNodeLostTrigger.java
@@ -39,11 +39,13 @@ import org.apache.solr.common.util.TimeSource;
 import org.apache.solr.core.SolrResourceLoader;
 import org.junit.After;
 import org.junit.Before;
+import org.junit.Ignore;
 import org.junit.Test;
 
 /**
  * Test for {@link NodeLostTrigger}
  */
+@Ignore // auto scaling removed in master anyway
 public class TestSimNodeLostTrigger extends SimSolrCloudTestCase {
   private static AtomicBoolean actionConstructorCalled = new AtomicBoolean(false);
   private static AtomicBoolean actionInitCalled = new AtomicBoolean(false);
diff --git a/solr/core/src/test/org/apache/solr/handler/component/TermsComponentTest.java b/solr/core/src/test/org/apache/solr/handler/component/TermsComponentTest.java
index 7103659..96e040c 100644
--- a/solr/core/src/test/org/apache/solr/handler/component/TermsComponentTest.java
+++ b/solr/core/src/test/org/apache/solr/handler/component/TermsComponentTest.java
@@ -20,6 +20,7 @@ import java.io.IOException;
 import java.util.Arrays;
 import java.util.regex.Pattern;
 
+import org.apache.lucene.util.LuceneTestCase;
 import org.apache.lucene.util.mutable.MutableValueDouble;
 import org.apache.lucene.util.mutable.MutableValueFloat;
 import org.apache.lucene.util.mutable.MutableValueInt;
@@ -35,6 +36,7 @@ import org.junit.BeforeClass;
 import org.junit.Test;
 
 
+@LuceneTestCase.Nightly // slow test
 public class TermsComponentTest extends SolrTestCaseJ4 {
 
   @BeforeClass
diff --git a/solr/solrj/src/java/org/apache/solr/common/ParWork.java b/solr/solrj/src/java/org/apache/solr/common/ParWork.java
index 31c0674..04739a4 100644
--- a/solr/solrj/src/java/org/apache/solr/common/ParWork.java
+++ b/solr/solrj/src/java/org/apache/solr/common/ParWork.java
@@ -72,7 +72,16 @@ public class ParWork implements Closeable {
 
   private static SysStats sysStats = SysStats.getSysStats();
 
-  private static class WorkUnit {
+    public static void closeExecutor() {
+      ExecutorService exec = THREAD_LOCAL_EXECUTOR.get();
+      if (exec != null) {
+        exec.shutdownNow();
+        ParWork.close(exec);
+        THREAD_LOCAL_EXECUTOR.set(null);
+      }
+    }
+
+    private static class WorkUnit {
     private final List<Object> objects;
     private final TimeTracker tracker;
     private final String label;
diff --git a/solr/solrj/src/java/org/apache/solr/common/ParWorkExecutor.java b/solr/solrj/src/java/org/apache/solr/common/ParWorkExecutor.java
index 42000ae..23d4215 100644
--- a/solr/solrj/src/java/org/apache/solr/common/ParWorkExecutor.java
+++ b/solr/solrj/src/java/org/apache/solr/common/ParWorkExecutor.java
@@ -27,7 +27,7 @@ public class ParWorkExecutor extends ThreadPoolExecutor {
     private static AtomicInteger threadNumber = new AtomicInteger(0);
 
     public ParWorkExecutor(String name, int maxPoolsSize) {
-        super(0,  maxPoolsSize,  KEEP_ALIVE_TIME, TimeUnit.SECONDS, new ArrayBlockingQueue<>(Integer.getInteger("solr.threadExecQueueSize", 30)), new ThreadFactory() {
+        super(0,  maxPoolsSize,  KEEP_ALIVE_TIME, TimeUnit.MILLISECONDS, new ArrayBlockingQueue<>(Integer.getInteger("solr.threadExecQueueSize", 30)), new ThreadFactory() {
 
             ThreadGroup group;
 
@@ -40,8 +40,11 @@ public class ParWorkExecutor extends ThreadPoolExecutor {
             public Thread newThread(Runnable r) {
                 Thread t = new Thread(group, r, name + threadNumber.getAndIncrement(), 0) {
                     public void run() {
-                        super.run();
-                        ParWork.close(ParWork.getExecutor());
+                        try {
+                            super.run();
+                        } finally {
+                            ParWork.closeExecutor();
+                        }
                     }
                 };
                 t.setDaemon(true);
diff --git a/solr/solrj/src/java/org/apache/solr/common/util/SolrQueuedThreadPool.java b/solr/solrj/src/java/org/apache/solr/common/util/SolrQueuedThreadPool.java
index c2de6e3..456be8d 100644
--- a/solr/solrj/src/java/org/apache/solr/common/util/SolrQueuedThreadPool.java
+++ b/solr/solrj/src/java/org/apache/solr/common/util/SolrQueuedThreadPool.java
@@ -705,7 +705,7 @@ public class SolrQueuedThreadPool extends ContainerLifeCycle implements ThreadFa
 
     protected void removeThread(Thread thread)
     {
-       ParWork.close(ParWork.getExecutor());
+       ParWork.closeExecutor();
         _threads.remove(thread);
     }
 
diff --git a/solr/test-framework/src/java/org/apache/solr/SolrIgnoredThreadsFilter.java b/solr/test-framework/src/java/org/apache/solr/SolrIgnoredThreadsFilter.java
index da5dc49..5016796 100644
--- a/solr/test-framework/src/java/org/apache/solr/SolrIgnoredThreadsFilter.java
+++ b/solr/test-framework/src/java/org/apache/solr/SolrIgnoredThreadsFilter.java
@@ -47,58 +47,15 @@ public class SolrIgnoredThreadsFilter implements ThreadFilter {
       return true;
     }
     
-    // HttpClient Connection evictor threads can take a moment to wake and shutdown
-    if (threadName.startsWith("Connection evictor")) {
-      return true;
-    }
-    
     // These is a java pool for the collection stream api
     if (threadName.startsWith("ForkJoinPool.")) {
       return true;
     }
-    
-    if (threadName.startsWith("Image Fetcher")) {
-      return true;
-    }
 
     if (threadName.startsWith("SessionTracker")) { // zk thread that will stop in a moment.
       return true;
     }
 
-    if (threadName.startsWith("CPUMonitoringThread")) { // zk thread that will stop in a moment.
-      return true;
-    }
-
-    if (threadName.startsWith("ParWork")) {
-      return true;
-    }
-    if (threadName.startsWith("solr-test-qtp")) {
-      return true;
-    }
-
-    // nocommit tmp hack
-    if (threadName.startsWith("ScheduledTrigger")) {
-      return true;
-    }
-    if (threadName.startsWith("NIOWorkerThread") || threadName.startsWith("EventThread")) {
-      return true;
-    }
-
-    if (threadName.startsWith("ConnnectionExpirer")) {
-      return true;
-    }
-    
-    if (threadName.startsWith("SolrCoreLoader") || threadName.startsWith("searcherExecutor") ) {
-      return true;
-    }
-
-    // nocommit - look into this - these client threads on the qtp can stick around, but are TERMINATED state
-    if (threadName.startsWith("httpClient-")) {
-      return true;
-    }
-
-
-
     return false;
   }
 }
diff --git a/solr/test-framework/src/java/org/apache/solr/SolrTestCase.java b/solr/test-framework/src/java/org/apache/solr/SolrTestCase.java
index 85e78bc..8fcf892 100644
--- a/solr/test-framework/src/java/org/apache/solr/SolrTestCase.java
+++ b/solr/test-framework/src/java/org/apache/solr/SolrTestCase.java
@@ -371,8 +371,10 @@ public class SolrTestCase extends LuceneTestCase {
     log.info("@After Class ------------------------------------------------------");
     try {
 
+      ParWork.closeExecutor();
+
       if (null != testExecutor) {
-        testExecutor.shutdown();
+        testExecutor.shutdownNow();
       }
 
 
@@ -522,14 +524,19 @@ public class SolrTestCase extends LuceneTestCase {
   }
 
   private static void interrupt(Thread thread, String nameContains) {
-    if (nameContains != null && thread.getName().contains(nameContains)) {
-      System.out.println("simulate interrupt on " + thread.getName());
+    if (nameContains != null && thread.getName().contains(nameContains) && nameContains.startsWith("ParWork")) {
+
+ //     System.out.println("simulate interrupt on " + thread.getName());
 //      thread.interrupt();
-//      try {
-//        thread.join(5000);
-//      } catch (InterruptedException e) {
-//        ParWork.propegateInterrupt(e);
-//      }
+      try {
+        thread.join(5000);
+      } catch (InterruptedException e) {
+        ParWork.propegateInterrupt(e);
+      }
+    }
+
+    if (nameContains != null && nameContains.startsWith("ParWork")) {
+      ParWork.closeExecutor();
     }
   }
 
diff --git a/solr/test-framework/src/java/org/apache/solr/cloud/ZkTestServer.java b/solr/test-framework/src/java/org/apache/solr/cloud/ZkTestServer.java
index e300204..2393c58 100644
--- a/solr/test-framework/src/java/org/apache/solr/cloud/ZkTestServer.java
+++ b/solr/test-framework/src/java/org/apache/solr/cloud/ZkTestServer.java
@@ -567,35 +567,39 @@ public class ZkTestServer implements Closeable {
 
         @Override
         public void run() {
-          ServerConfig config = new ServerConfig() {
-
-            {
-              setClientPort(ZkTestServer.this.clientPort);
-              this.dataDir = zkDir.toFile();
-              this.dataLogDir = zkDir.toFile();
-              this.tickTime = theTickTime;
-              this.maxSessionTimeout = ZkTestServer.this.maxSessionTimeout;
-              this.minSessionTimeout = ZkTestServer.this.minSessionTimeout;
-            }
+          try {
+            ServerConfig config = new ServerConfig() {
+
+              {
+                setClientPort(ZkTestServer.this.clientPort);
+                this.dataDir = zkDir.toFile();
+                this.dataLogDir = zkDir.toFile();
+                this.tickTime = theTickTime;
+                this.maxSessionTimeout = ZkTestServer.this.maxSessionTimeout;
+                this.minSessionTimeout = ZkTestServer.this.minSessionTimeout;
+              }
 
-            public void setClientPort(int clientPort) {
-              if (clientPortAddress != null) {
-                try {
-                  this.clientPortAddress = new InetSocketAddress(
-                          InetAddress.getByName(clientPortAddress.getHostName()), clientPort);
-                } catch (UnknownHostException e) {
-                  throw new RuntimeException(e);
+              public void setClientPort(int clientPort) {
+                if (clientPortAddress != null) {
+                  try {
+                    this.clientPortAddress = new InetSocketAddress(
+                            InetAddress.getByName(clientPortAddress.getHostName()), clientPort);
+                  } catch (UnknownHostException e) {
+                    throw new RuntimeException(e);
+                  }
+                } else {
+                  this.clientPortAddress = new InetSocketAddress(clientPort);
                 }
-              } else {
-                this.clientPortAddress = new InetSocketAddress(clientPort);
-              }
 
+              }
+            };
+            try {
+              zkServer.runFromConfig(config);
+            } catch (Throwable t) {
+              log.error("zkServer error", t);
             }
-          };
-          try {
-            zkServer.runFromConfig(config);
-          } catch (Throwable t) {
-            log.error("zkServer error", t);
+          } finally {
+            ParWork.closeExecutor();
           }
         }
       };