You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@solr.apache.org by "Mike Drob (Jira)" <ji...@apache.org> on 2022/08/18 17:24:00 UTC

[jira] [Commented] (SOLR-16187) ExecutorUtil#awaitTermination shouldn't wait forever

    [ https://issues.apache.org/jira/browse/SOLR-16187?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17581455#comment-17581455 ] 

Mike Drob commented on SOLR-16187:
----------------------------------

I think this caused the failure that we saw in https://builds.apache.org/job/Solr/job/Solr-Check-main/4429/testReport/junit/org.apache.solr.client.solrj.impl/CloudSolrClientCacheTest/classMethod/

{noformat}
com.carrotsearch.randomizedtesting.ThreadLeakError: 1 thread leaked from SUITE scope at org.apache.solr.client.solrj.impl.CloudSolrClientCacheTest: 
   1) Thread[id=427, name=CloudSolrClient ThreadPool-240-thread-1, state=RUNNABLE, group=TGRP-CloudSolrClientCacheTest]
        at java.base@11.0.12/jdk.internal.misc.Unsafe.unpark(Native Method)
        at java.base@11.0.12/java.util.concurrent.locks.LockSupport.unpark(LockSupport.java:160)
        at java.base@11.0.12/java.util.concurrent.locks.AbstractQueuedSynchronizer.unparkSuccessor(AbstractQueuedSynchronizer.java:709)
        at java.base@11.0.12/java.util.concurrent.locks.AbstractQueuedSynchronizer.release(AbstractQueuedSynchronizer.java:1305)
        at java.base@11.0.12/java.util.concurrent.locks.ReentrantLock.unlock(ReentrantLock.java:439)
        at java.base@11.0.12/java.util.concurrent.ThreadPoolExecutor.tryTerminate(ThreadPoolExecutor.java:726)
        at java.base@11.0.12/java.util.concurrent.ThreadPoolExecutor.processWorkerExit(ThreadPoolExecutor.java:994)
        at java.base@11.0.12/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.base@11.0.12/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
        at java.base@11.0.12/java.lang.Thread.run(Thread.java:834)
	at __randomizedtesting.SeedInfo.seed([56EBCA685869287E]:0)
{noformat}

I can't think of any other way that this thread pool would still be running after the test has already completed.

> ExecutorUtil#awaitTermination shouldn't wait forever
> ----------------------------------------------------
>
>                 Key: SOLR-16187
>                 URL: https://issues.apache.org/jira/browse/SOLR-16187
>             Project: Solr
>          Issue Type: Bug
>            Reporter: Kevin Risden
>            Assignee: Kevin Risden
>            Priority: Major
>          Time Spent: 40m
>  Remaining Estimate: 0h
>
> While looking at some of the other thread leak issues, found that ExecutorUtil#awaitTermination is waiting basically forever:
> https://github.com/apache/solr/blob/main/solr/solrj/src/java/org/apache/solr/common/util/ExecutorUtil.java#L98
> {code:java}
> public static void awaitTermination(ExecutorService pool) {
>     boolean shutdown = false;
>     while (!shutdown) {
>       try {
>         // Wait a while for existing tasks to terminate
>         shutdown = pool.awaitTermination(60, TimeUnit.SECONDS);
>       } catch (InterruptedException ie) {
>         // Preserve interrupt status
>         Thread.currentThread().interrupt();
>       }
>     }
>   }
> {code}
> Instead it should be possible to wait and then if still not shutdown then interrupt the threads? ie: pool.shutdownNow() then another awaitTermination to at least limit the termination time to 2*60 seconds?
> This would at least have some bound to shutting stuff down.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org