I have a spring boot (1.5.2) web application that runs in tomcat (8.5) as a sole web app. The total number of threads in the JVM (openjdk 1.8.0_181) increases monotonously almost (though not completely) at a constant rate, going from a few hundred in the beginning, to about 3000 in a week. By that time, the majority of the threads stack traces look like:
WAITING Thread[pool-917-thread-1,5,main]
sun.misc.Unsafe.park(Native Method)
java.util.concurrent.locks.LockSupport.park(LockSupport.java:175)
java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2039)
java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:442)
java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1074)
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1134)
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
java.lang.Thread.run(Thread.java:748)
The application works otherwise fine, these threads do not seem to take up too much memory (at least compared to the tens of gigabytes the application normally consumes), but their existence points to some hidden leak inside the application. As of writing this, I can not currently find a thread named pool-.*
in a different state, so I don't know what they normally do before going zombie. The application is never redeployed without a tomcat restart.
My question would be whether anyone encountered anything similar and how they solved it, and if not, how could I diagnose why these threads are being created and not removed afterwards.