You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@solr.apache.org by "ASF subversion and git services (Jira)" <ji...@apache.org> on 2022/09/06 14:31: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=17600795#comment-17600795 ] 

ASF subversion and git services commented on SOLR-16187:
--------------------------------------------------------

Commit fa9dfac8a7cce56020f808cb136ac6b6fecde5d8 in solr's branch refs/heads/main from Kevin Risden
[ https://gitbox.apache.org/repos/asf?p=solr.git;h=fa9dfac8a7c ]

SOLR-16187: ExecutorUtil#awaitTermination shouldn't wait forever (#840)



> 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: 1h
>  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