curator-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Wei Gao (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CURATOR-39) ServiceProvider thread is not closed during ServiceDiscovery close
Date Tue, 07 Jun 2016 21:55:20 GMT

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

Wei Gao commented on CURATOR-39:
--------------------------------

I don't think this bug is fixed by CURATOR-27.

ServiceProviderImpl constructor accept threadFactory only, and it will use ServiceCacheBuilder
to build cache (with threadFactory). In ServiceCacheImpl constructor, if thread factory provided,
it call "convertThreadFactory" to create CloseableExecutorService, but this will create CloseableExecutorService
with default value of "shutdownOnClose", which is false.

So, even close ServiceProvider, it will not shutdown cache's thread pool, which cause thread
leak.

Any idea why builder pattern not accept ExecutorService, so we can manage lifecycle of thread
pool, and use real thread pool instead of single thread?

> ServiceProvider thread is not closed during ServiceDiscovery close
> ------------------------------------------------------------------
>
>                 Key: CURATOR-39
>                 URL: https://issues.apache.org/jira/browse/CURATOR-39
>             Project: Apache Curator
>          Issue Type: Bug
>            Reporter: Colin Morelli
>            Assignee: Ioannis Canellos
>             Fix For: 2.3.0
>
>
> I'm using 2.0.1-incubating, using the following to build a ServiceProvider:
> serviceProvider = serviceDiscovery.serviceProviderBuilder()
>                     .serviceName(name)
>                     .providerStrategy(new RoundRobinStrategy<DiscoverableService>())
>                     .build();
> serviceProvider.start();
> I have a name => ServiceProvider map that stores all my service providers. During
shutdown, I call:
>         for (ServiceProvider serviceProvider : serviceProviderMap.values()) {
>             serviceProvider.close();
>         }
>         serviceDiscovery.close();
> Which is redundant, it seems, because serviceDiscovery itself appears to shutdown the
providers. However, I still end up with a dangling "ServiceProvider-0" thread that keeps Tomcat
open.
> If I start the container up, without making a service call (so I don't allocate any ServiceProviders),
Tomcat shuts down cleanly. As soon as a ServiceProvider is allocated (by making a service
call) Tomcat hangs during shutdown, and informs me of the remaining thread. I will try to
provide more information as it becomes available to me.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message