如何在wildfly中找到等待线程的源

8aqjt8rx  于 2021-07-06  发布在  Java
关注(0)|答案(0)|浏览(278)

我将wildfly16与java11结合使用,发现创建了大量线程,甚至导致崩溃。
这些线程中的绝大多数(数千个)在jstack输出中是这样的:

pool-725-thread-1 priority:5 - threadId:0x000000000c39e800 - nativeId:0x85146 - nativeId (decimal):545094 - state:WAITING
stackTrace:
java.lang.Thread.State: WAITING (parking)
at jdk.internal.misc.Unsafe.park(java.base@11.0.2/Native Method)
- parking to wait for <0x000000072bf75908> (a java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject)
at java.util.concurrent.locks.LockSupport.park(java.base@11.0.2/LockSupport.java:194)
at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(java.base@11.0.2/AbstractQueuedSynchronizer.java:2081)
at java.util.concurrent.LinkedBlockingQueue.take(java.base@11.0.2/LinkedBlockingQueue.java:433)
at java.util.concurrent.ThreadPoolExecutor.getTask(java.base@11.0.2/ThreadPoolExecutor.java:1054)
at java.util.concurrent.ThreadPoolExecutor.runWorker(java.base@11.0.2/ThreadPoolExecutor.java:1114)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(java.base@11.0.2/ThreadPoolExecutor.java:628)
at java.lang.Thread.run(java.base@11.0.2/Thread.java:834)
Locked ownable synchronizers:
- None

“wait for<>”部分总是为每个线程显示另一个值。名称模式总是这样的“pool--thread-1”(为什么总是thread-1而不是另一个pool编号?)
跟踪只告诉我线程是由threadpoolexecutor创建的。
我怎么知道是谁创造了它们,它们都在等待什么呢?

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题