最近在我的项目服务器上遇到了死锁情况,在查看线程堆栈跟踪时,我们找不到太多信息。这是堆栈跟踪:
"pool-1-thread-70":
waiting to lock Monitor@0x00007f60d40a0760 (Object@0x00000000b9c02a00, a com/hal/real/Real),
which is held by "pool-17-thread-81"
"pool-17-thread-81":
waiting to lock Monitor@0x00007f60d410b4e0 (Object@0x00000000b9c03980, a java/util/Collections$SynchronizedMap),
which is held by "pool-1-thread-70"
Found a total of 1 deadlock.
Thread 23794: (state = BLOCKED)
- sun.misc.Unsafe.park(boolean, long) @bci=0 (Compiled frame; information may be imprecise)
- java.util.concurrent.locks.LockSupport.parkNanos(java.lang.Object, long) @bci=20, line=226 (Compiled frame)
- java.util.concurrent.SynchronousQueue$TransferStack.awaitFulfill(java.util.concurrent.SynchronousQueue$TransferStack$SNode, boolean, long) @bci=174, line=453 (Compiled frame)
- java.util.concurrent.SynchronousQueue$TransferStack.transfer(java.lang.Object, boolean, long) @bci=102, line=352 (Interpreted frame)
- java.util.concurrent.SynchronousQueue.poll(long, java.util.concurrent.TimeUnit) @bci=11, line=903 (Compiled frame)
- java.util.concurrent.ThreadPoolExecutor.getTask() @bci=141, line=1043 (Compiled frame)
- java.util.concurrent.ThreadPoolExecutor.runWorker(java.util.concurrent.ThreadPoolExecutor$Worker) @bci=17, line=1103 (Compiled frame)
- java.util.concurrent.ThreadPoolExecutor$Worker.run() @bci=5, line=603 (Interpreted frame)
- java.lang.Thread.run() @bci=11, line=679 (Interpreted frame)
Thread 23792: (state = BLOCKED)
- sun.misc.Unsafe.park(boolean, long) @bci=0 (Compiled frame; information may be imprecise)
- java.util.concurrent.locks.LockSupport.parkNanos(java.lang.Object, long) @bci=20, line=226 (Compiled frame)
- java.util.concurrent.SynchronousQueue$TransferStack.awaitFulfill(java.util.concurrent.SynchronousQueue$TransferStack$SNode, boolean, long) @bci=174, line=453 (Compiled frame)
- java.util.concurrent.SynchronousQueue$TransferStack.transfer(java.lang.Object, boolean, long) @bci=102, line=352 (Interpreted frame)
- java.util.concurrent.SynchronousQueue.poll(long, java.util.concurrent.TimeUnit) @bci=11, line=903 (Compiled frame)
- java.util.concurrent.ThreadPoolExecutor.getTask() @bci=141, line=1043 (Compiled frame)
- java.util.concurrent.ThreadPoolExecutor.runWorker(java.util.concurrent.ThreadPoolExecutor$Worker) @bci=17, line=1103 (Compiled frame)
- java.util.concurrent.ThreadPoolExecutor$Worker.run() @bci=5, line=603 (Interpreted frame)
- java.lang.Thread.run() @bci=11, line=679 (Interpreted frame)
Thread 23757: (state = BLOCKED)
- com.hal.real.RealUser.getRegularSnapshot() @bci=15, line=646 (Interpreted frame)
- com.hal.real.RealUser.getRealSnapshot() @bci=10, line=671 (Interpreted frame)
- com.hal.real.RealUser.getRealUsers() @bci=9, line=618 (Interpreted frame)
- com.hal.real.Real.getAvat() @bci=4, line=1146 (Interpreted frame)
- com.hal.real.RealManager.getWebServers(com.hal.real.Real, java.util.List) @bci=184, line=220 (Interpreted frame)
- com.hal.message.core.StreamUriReq.exec() @bci=398, line=108 (Interpreted frame)
- com.hal.real.RealClientHandler.msgReceived(org.apache.mina.core.session.IoSession, java.lang.Object) @bci=91, line=83 (Interpreted frame)
- org.apache.mina.core.filterchain.DefaultIoFilterChain$TailFilter.messageReceived(org.apache.mina.core.filterchain.IoFilter$NextFilter, org.apache.mina.core.session.IoSession, java.lang.Object) @bci=51, line=690 (Interpreted frame)
- org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageReceived(org.apache.mina.core.filterchain.IoFilterChain$Entry, org.apache.mina.core.session.IoSession, java.lang.Object) @bci=22, line=417 (Interpreted frame)
- org.apache.mina.core.filterchain.DefaultIoFilterChain.access$1200(org.apache.mina.core.filterchain.DefaultIoFilterChain, org.apache.mina.core.filterchain.IoFilterChain$Entry, org.apache.mina.core.session.IoSession, java.lang.Object) @bci=4, line=47 (Interpreted frame)
- org.apache.mina.core.filterchain.DefaultIoFilterChain$EntryImpl$1.messageReceived(org.apache.mina.core.session.IoSession, java.lang.Object) @bci=18, line=765 (Interpreted frame)
- org.apache.mina.core.filterchain.IoFilterEvent.fire() @bci=110, line=74 (Interpreted frame)
- org.apache.mina.core.session.IoEvent.run() @bci=1, line=63 (Interpreted frame)
- java.util.concurrent.ThreadPoolExecutor.runWorker(java.util.concurrent.ThreadPoolExecutor$Worker) @bci=46, line=1110 (Compiled frame)
- java.util.concurrent.ThreadPoolExecutor$Worker.run() @bci=5, line=603 (Interpreted frame)
- java.lang.Thread.run() @bci=11, line=679 (Interpreted frame)
任何方法来解决这个问题。显然,pool-1-thread-70和pool-17-thread-81是导致死锁的线程,但是没有关于它们在发生此死锁时访问哪些函数以及线程已锁定的同步映射的信息