curator-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Colin Morelli (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CURATOR-39) ServiceProvider thread is not closed during ServiceDiscovery close
Date Tue, 25 Jun 2013 10:51:19 GMT

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

Colin Morelli commented on CURATOR-39:
--------------------------------------

This is the thread dump after the application is shut down:

"ServiceProvider-0@20902" daemon prio=5 tid=0x7a nid=NA waiting
  java.lang.Thread.State: WAITING
	  at sun.misc.Unsafe.park(Unsafe.java:-1)
	  at java.util.concurrent.locks.LockSupport.park(LockSupport.java:186)
	  at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2043)
	  at java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:442)
	  at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1068)
	  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130)
	  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
	  at java.lang.Thread.run(Thread.java:722)

The thread simply has nothing to process. The fix seems pretty simple to me, inside CloseableExecutorService,
the close() method should call the shutdown() method of the ExecutorService, which it doesn't
do currently.
                
> 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: Jordan Zimmerman
>
> This may simple be an issue on my end, but I believe it to be an issue in Curator. 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 is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message