ScheduledThreadPoolExecutor not shutting down completely


(Arivazhagan Jeganathan) #1

I am using Elasticsearch 1.5.1 with Java application. I have been monitoring the application with plumbr tool.

Whenever JVM stop/redeploy is done, plumbr warns about Perm Gen memory leak issue.

Log indicates that ,
Your application leaks classloaders because the application has not shut down the java.util.concurrent.ScheduledThreadPoolExecutor thread pool before the redeploy. This thread pool has 1 tasks in queue waiting to be executed and 1 threads currently running.
pool-11-thread-1
See below to find out, what are threads from this pool doing right now.
1 threads run:
sun.misc.Unsafe.park(Native Method)
java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:226)
java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.awaitNanos(AbstractQueuedSynchronizer.java:2082)
java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:1090)
java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:807)
java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1043)
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1103)
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
java.lang.Thread.run(Thread.java:722).

Can some one help if we can shutdown this ScheduledThreadPoolExecutor completely when JVM stops.


(Mark Walkom) #2

Please keep it to the one thread - [Solved] Classloader Leak in Elasticsearch-ScheduledThreadPoolExecutor not cleared


(Mark Walkom) #3