一、概述
有些时候我们需要查看下jvm中的线程执行情况,比如,发现服务器的CPU的负载突然增高了、出现了死锁、死循环等,我们该如何分析呢?
由于程序是正常运行的,没有任何的输出,从日志方面也看不出什么问题,所以就需要看下jvm的内部线程的执行情况,然后再进行分析查找出原因。
这个时候,就需要借助于jstack命令了,jstack的作用是将正在运行的jvm的线程情况进行快照,并且打印出来:
#用法:jstack <pid>
jstack 18424
E:accpY2进阶内容JVM>jstack 18424 2020-03-03 18:15:40 Full thread dump OpenJDK 64-Bit Server VM (11.0.3+12-b304.39 mixed mode, sharing): Threads class SMR info: _java_thread_list=0x0000000053bf4c80, length=45, elements={ 0x000000000263f800, 0x000000001859c800, 0x00000000185aa000, 0x00000000185b9000, 0x00000000185bc000, 0x00000000185bf800, 0x00000000185c1000, 0x00000000185cd800, 0x0000000018587000, 0x0000000019be0800, 0x000000001a37f000, 0x000000001afef800, 0x000000001a2e7000, 0x000000001b015800, 0x000000001ba94000, 0x000000001bbaa000, 0x000000001bef3800, 0x000000001d891000, 0x000000001d88f800, 0x000000001d893800, 0x000000001dd61800, 0x000000001fc34000, 0x0000000024d3a000, 0x0000000031674800, 0x0000000038b6d800, 0x0000000038b83800, 0x0000000038b8f800, 0x0000000038b8b000, 0x0000000038b92000, 0x0000000038b97000, 0x0000000038b98000, 0x0000000038b98800, 0x0000000038b9a800, 0x000000004e0c8000, 0x000000004e0ce800, 0x000000004e0d1000, 0x000000004e0e0800, 0x0000000054720800, 0x0000000054720000, 0x000000005471d800, 0x0000000054739000, 0x000000005471b800, 0x0000000054726800, 0x000000005472b000, 0x000000005471c800 } "main" #1 prio=5 os_prio=0 cpu=1234.38ms elapsed=8454.78s tid=0x000000000263f800 nid=0x11424 waiting on condition [0x0000000000000000] java.lang.Thread.State: RUNNABLE "Reference Handler" #2 daemon prio=10 os_prio=2 cpu=46.88ms elapsed=8453.53s tid=0x000000001859c800 nid=0xffdc waiting on condition [0x000000001900f000] java.lang.Thread.State: RUNNABLE at java.lang.ref.Reference.waitForReferencePendingList(java.base@11.0.3/Native Method) at java.lang.ref.Reference.processPendingReferences(java.base@11.0.3/Reference.java:241) at java.lang.ref.Reference$ReferenceHandler.run(java.base@11.0.3/Reference.java:213) "Finalizer" #3 daemon prio=8 os_prio=1 cpu=15.63ms elapsed=8453.53s tid=0x00000000185aa000 nid=0x15ad4 in Object.wait() [0x000000001910f000] java.lang.Thread.State: WAITING (on object monitor) at java.lang.Object.wait(java.base@11.0.3/Native Method) - waiting on <no object reference available> at java.lang.ref.ReferenceQueue.remove(java.base@11.0.3/ReferenceQueue.java:155) - waiting to re-lock in wait() <0x00000000e0c1ddf0> (a java.lang.ref.ReferenceQueue$Lock) at java.lang.ref.ReferenceQueue.remove(java.base@11.0.3/ReferenceQueue.java:176) at java.lang.ref.Finalizer$FinalizerThread.run(java.base@11.0.3/Finalizer.java:170) "Signal Dispatcher" #4 daemon prio=9 os_prio=2 cpu=0.00ms elapsed=8453.35s tid=0x00000000185b9000 nid=0xb278 runnable [0x0000000000000000] java.lang.Thread.State: RUNNABLE "Attach Listener" #5 daemon prio=5 os_prio=2 cpu=0.00ms elapsed=8453.35s tid=0x00000000185bc000 nid=0x1bdb4 waiting on condition [0x0000000000000000] java.lang.Thread.State: RUNNABLE "C2 CompilerThread0" #6 daemon prio=9 os_prio=2 cpu=172921.88ms elapsed=8453.35s tid=0x00000000185bf800 nid=0x15d0 waiting on condition [0x0000000000000000] java.lang.Thread.State: RUNNABLE No compile task "C1 CompilerThread0" #7 daemon prio=9 os_prio=2 cpu=32078.13ms elapsed=8453.35s tid=0x00000000185c1000 nid=0x49b0 waiting on condition [0x0000000000000000] java.lang.Thread.State: RUNNABLE No compile task "Sweeper thread" #8 daemon prio=9 os_prio=2 cpu=2796.88ms elapsed=8453.35s tid=0x00000000185cd800 nid=0x3b48 runnable [0x0000000000000000] java.lang.Thread.State: RUNNABLE "Common-Cleaner" #9 daemon prio=8 os_prio=1 cpu=15.63ms elapsed=8452.78s tid=0x0000000018587000 nid=0x2a58 in Object.wait() [0x0000000019b6f000] java.lang.Thread.State: TIMED_WAITING (on object monitor) at java.lang.Object.wait(java.base@11.0.3/Native Method) - waiting on <no object reference available> at java.lang.ref.ReferenceQueue.remove(java.base@11.0.3/ReferenceQueue.java:155) - waiting to re-lock in wait() <0x00000000e0e614a8> (a java.lang.ref.ReferenceQueue$Lock) at jdk.internal.ref.CleanerImpl.run(java.base@11.0.3/CleanerImpl.java:148) at java.lang.Thread.run(java.base@11.0.3/Thread.java:834) at jdk.internal.misc.InnocuousThread.run(java.base@11.0.3/InnocuousThread.java:134) "Service Thread" #10 daemon prio=9 os_prio=0 cpu=93.75ms elapsed=8450.69s tid=0x0000000019be0800 nid=0x1d1b8 runnable [0x0000000000000000] java.lang.Thread.State: RUNNABLE "Java2D Disposer" #12 daemon prio=10 os_prio=2 cpu=15.63ms elapsed=8445.69s tid=0x000000001a37f000 nid=0x2fe0 in Object.wait() [0x000000001aacf000] java.lang.Thread.State: WAITING (on object monitor) at java.lang.Object.wait(java.base@11.0.3/Native Method) - waiting on <no object reference available> at java.lang.ref.ReferenceQueue.remove(java.base@11.0.3/ReferenceQueue.java:155) - waiting to re-lock in wait() <0x00000000e0e887f8> (a java.lang.ref.ReferenceQueue$Lock) at java.lang.ref.ReferenceQueue.remove(java.base@11.0.3/ReferenceQueue.java:176) at sun.java2d.Disposer.run(java.desktop@11.0.3/Disposer.java:144) at java.lang.Thread.run(java.base@11.0.3/Thread.java:834) "AWT-Shutdown" #13 prio=5 os_prio=0 cpu=0.00ms elapsed=8445.69s tid=0x000000001afef800 nid=0xcf8 in Object.wait() [0x000000001af8f000] java.lang.Thread.State: WAITING (on object monitor) at java.lang.Object.wait(java.base@11.0.3/Native Method) - waiting on <no object reference available> at java.lang.Object.wait(java.base@11.0.3/Object.java:328) at sun.awt.AWTAutoShutdown.run(java.desktop@11.0.3/AWTAutoShutdown.java:291) - waiting to re-lock in wait() <0x00000000e0e9d480> (a java.lang.Object) at java.lang.Thread.run(java.base@11.0.3/Thread.java:834) "AWT-Windows" #14 daemon prio=6 os_prio=0 cpu=20984.38ms elapsed=8445.69s tid=0x000000001a2e7000 nid=0x1c5dc runnable [0x000000001c07f000] java.lang.Thread.State: RUNNABLE at sun.awt.windows.WToolkit.eventLoop(java.desktop@11.0.3/Native Method) at sun.awt.windows.WToolkit.run(java.desktop@11.0.3/WToolkit.java:305) at java.lang.Thread.run(java.base@11.0.3/Thread.java:834) "AWT-EventQueue-0 2019.2.1#IU-192.6262.58 IDEA, eap:false, os:Windows 10 10.0, java-version:JetBrains s.r.o 11.0.3+12-b304.39 2019.2.1#IU-192.6262.58 IDEA, eap:false, os:Windows 10 10.0, java-version:JetBrains s.r.o 11.0.3+12-b304.39" #16 prio=6 os_prio=0 cpu=85750.00ms elapsed=8445.65s tid=0x000000001b015800 nid=0x13284 waiting on condition [0x000000001c24f000] java.lang.Thread.State: WAITING (parking) at jdk.internal.misc.Unsafe.park(java.base@11.0.3/Native Method) - parking to wait for <0x00000000e0e88828> (a java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject) at java.util.concurrent.locks.LockSupport.park(java.base@11.0.3/LockSupport.java:194) at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(java.base@11.0.3/AbstractQueuedSynchronizer.java:2081) at java.awt.EventQueue.getNextEvent(java.desktop@11.0.3/EventQueue.java:572) at com.intellij.ide.IdeEventQueue.getNextEvent(IdeEventQueue.java:543) at java.awt.EventDispatchThread.pumpOneEventForFilters(java.desktop@11.0.3/EventDispatchThread.java:190) at java.awt.EventDispatchThread.pumpEventsForFilter(java.desktop@11.0.3/EventDispatchThread.java:124) at java.awt.EventDispatchThread.pumpEventsForHierarchy(java.desktop@11.0.3/EventDispatchThread.java:113) at java.awt.EventDispatchThread.pumpEvents(java.desktop@11.0.3/EventDispatchThread.java:109) at java.awt.EventDispatchThread.pumpEvents(java.desktop@11.0.3/EventDispatchThread.java:101) at java.awt.EventDispatchThread.run(java.desktop@11.0.3/EventDispatchThread.java:90) "Netty Builtin Server 1" #18 prio=5 os_prio=0 cpu=125.00ms elapsed=8442.88s tid=0x000000001ba94000 nid=0x29b0 runnable [0x000000001d79f000] java.lang.Thread.State: RUNNABLE at sun.nio.ch.WindowsSelectorImpl$SubSelector.poll0(java.base@11.0.3/Native Method) at sun.nio.ch.WindowsSelectorImpl$SubSelector.poll(java.base@11.0.3/WindowsSelectorImpl.java:339) at sun.nio.ch.WindowsSelectorImpl.doSelect(java.base@11.0.3/WindowsSelectorImpl.java:167) at sun.nio.ch.SelectorImpl.lockAndDoSelect(java.base@11.0.3/SelectorImpl.java:124) - locked <0x00000000e17fd998> (a io.netty.channel.nio.SelectedSelectionKeySet) - locked <0x00000000e18e9d50> (a sun.nio.ch.WindowsSelectorImpl) at sun.nio.ch.SelectorImpl.select(java.base@11.0.3/SelectorImpl.java:136) at io.netty.channel.nio.SelectedSelectionKeySetSelector.select(SelectedSelectionKeySetSelector.java:62) at io.netty.channel.nio.NioEventLoop.select(NioEventLoop.java:806) at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:454) at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:918) at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74) at java.lang.Thread.run(java.base@11.0.3/Thread.java:834) "Periodic tasks thread" #20 daemon prio=5 os_prio=0 cpu=140.63ms elapsed=8442.56s tid=0x000000001bbaa000 nid=0x1520c waiting on condition [0x000000001ea6f000] java.lang.Thread.State: TIMED_WAITING (parking) at jdk.internal.misc.Unsafe.park(java.base@11.0.3/Native Method) - parking to wait for <0x00000000e17fd9f8> (a java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject) at java.util.concurrent.locks.LockSupport.parkNanos(java.base@11.0.3/LockSupport.java:234) at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.awaitNanos(java.base@11.0.3/AbstractQueuedSynchronizer.java:2123) at java.util.concurrent.DelayQueue.take(java.base@11.0.3/DelayQueue.java:229) at com.intellij.util.concurrency.AppDelayQueue.lambda$new$0(AppDelayQueue.java:40) at com.intellij.util.concurrency.AppDelayQueue$$Lambda$206/0x0000000840265440.run(Unknown Source) at java.lang.Thread.run(java.base@11.0.3/Thread.java:834) "Batik CleanerThread" #26 daemon prio=4 os_prio=-1 cpu=0.00ms elapsed=8440.23s tid=0x000000001bef3800 nid=0x2dec in Object.wait() [0x000000001f36f000] java.lang.Thread.State: WAITING (on object monitor) at java.lang.Object.wait(java.base@11.0.3/Native Method) - waiting on <0x00000000e208e048> (a java.lang.ref.ReferenceQueue$Lock) at java.lang.ref.ReferenceQueue.remove(java.base@11.0.3/ReferenceQueue.java:155) - waiting to re-lock in wait() <0x00000000e208e048> (a java.lang.ref.ReferenceQueue$Lock) at java.lang.ref.ReferenceQueue.remove(java.base@11.0.3/ReferenceQueue.java:176) at org.apache.batik.util.CleanerThread.run(CleanerThread.java:106) "fsnotifier64.exe" #29 prio=4 os_prio=-1 cpu=0.00ms elapsed=8421.44s tid=0x000000001d891000 nid=0xb62c runnable [0x000000001a8ce000] java.lang.Thread.State: RUNNABLE at java.lang.ProcessImpl.waitForInterruptibly(java.base@11.0.3/Native Method) at java.lang.ProcessImpl.waitFor(java.base@11.0.3/ProcessImpl.java:484) at com.intellij.execution.process.ProcessWaitFor.lambda$null$0(ProcessWaitFor.java:48) at com.intellij.execution.process.ProcessWaitFor$$Lambda$368/0x0000000840605840.run(Unknown Source) at com.intellij.util.ConcurrencyUtil.runUnderThreadName(ConcurrencyUtil.java:208) at com.intellij.execution.process.ProcessWaitFor.lambda$new$1(ProcessWaitFor.java:43) at com.intellij.execution.process.ProcessWaitFor$$Lambda$365/0x0000000840603040.run(Unknown Source) at java.util.concurrent.Executors$RunnableAdapter.call(java.base@11.0.3/Executors.java:515) at java.util.concurrent.FutureTask.run(java.base@11.0.3/FutureTask.java:264) at java.util.concurrent.ThreadPoolExecutor.runWorker(java.base@11.0.3/ThreadPoolExecutor.java:1128) at java.util.concurrent.ThreadPoolExecutor$Worker.run(java.base@11.0.3/ThreadPoolExecutor.java:628) at java.lang.Thread.run(java.base@11.0.3/Thread.java:834) "BaseDataReader: output stream of fsnotifier64.exe" #30 prio=4 os_prio=-1 cpu=2109.38ms elapsed=8421.44s tid=0x000000001d88f800 nid=0x2cdc runnable [0x000000002143f000] java.lang.Thread.State: RUNNABLE at java.io.FileInputStream.readBytes(java.base@11.0.3/Native Method) at java.io.FileInputStream.read(java.base@11.0.3/FileInputStream.java:279) at java.io.BufferedInputStream.read1(java.base@11.0.3/BufferedInputStream.java:290) at java.io.BufferedInputStream.read(java.base@11.0.3/BufferedInputStream.java:351) - locked <0x00000000e2affc00> (a java.io.BufferedInputStream) at sun.nio.cs.StreamDecoder.readBytes(java.base@11.0.3/StreamDecoder.java:284) at sun.nio.cs.StreamDecoder.implRead(java.base@11.0.3/StreamDecoder.java:326) at sun.nio.cs.StreamDecoder.read(java.base@11.0.3/StreamDecoder.java:178) - locked <0x00000000e4f59810> (a com.intellij.util.io.BaseInputStreamReader) at java.io.InputStreamReader.read(java.base@11.0.3/InputStreamReader.java:185) at java.io.Reader.read(java.base@11.0.3/Reader.java:229) at com.intellij.util.io.BaseOutputReader.readAvailableBlocking(BaseOutputReader.java:146) at com.intellij.util.io.BaseDataReader.readAvailable(BaseDataReader.java:77) at com.intellij.util.io.BaseDataReader.doRun(BaseDataReader.java:155) at com.intellij.util.io.BaseDataReader$$Lambda$369/0x0000000840605c40.run(Unknown Source) at com.intellij.util.ConcurrencyUtil.runUnderThreadName(ConcurrencyUtil.java:208) at com.intellij.util.io.BaseDataReader.lambda$start$0(BaseDataReader.java:61) at com.intellij.util.io.BaseDataReader$$Lambda$366/0x0000000840603440.run(Unknown Source) at java.util.concurrent.Executors$RunnableAdapter.call(java.base@11.0.3/Executors.java:515) at java.util.concurrent.FutureTask.run(java.base@11.0.3/FutureTask.java:264) at java.util.concurrent.ThreadPoolExecutor.runWorker(java.base@11.0.3/ThreadPoolExecutor.java:1128) at java.util.concurrent.ThreadPoolExecutor$Worker.run(java.base@11.0.3/ThreadPoolExecutor.java:628) at java.lang.Thread.run(java.base@11.0.3/Thread.java:834) "BaseDataReader: error stream of fsnotifier64.exe" #31 prio=4 os_prio=-1 cpu=0.00ms elapsed=8421.44s tid=0x000000001d893800 nid=0x5fb8 runnable [0x0000000023f2e000] java.lang.Thread.State: RUNNABLE at java.io.FileInputStream.readBytes(java.base@11.0.3/Native Method) at java.io.FileInputStream.read(java.base@11.0.3/FileInputStream.java:279) at sun.nio.cs.StreamDecoder.readBytes(java.base@11.0.3/StreamDecoder.java:284) at sun.nio.cs.StreamDecoder.implRead(java.base@11.0.3/StreamDecoder.java:326) at sun.nio.cs.StreamDecoder.read(java.base@11.0.3/StreamDecoder.java:178) - locked <0x00000000e4f721b0> (a com.intellij.util.io.BaseInputStreamReader) at java.io.InputStreamReader.read(java.base@11.0.3/InputStreamReader.java:185) at java.io.Reader.read(java.base@11.0.3/Reader.java:229) at com.intellij.util.io.BaseOutputReader.readAvailableBlocking(BaseOutputReader.java:146) at com.intellij.util.io.BaseDataReader.readAvailable(BaseDataReader.java:77) at com.intellij.util.io.BaseDataReader.doRun(BaseDataReader.java:155) at com.intellij.util.io.BaseDataReader$$Lambda$369/0x0000000840605c40.run(Unknown Source) at com.intellij.util.ConcurrencyUtil.runUnderThreadName(ConcurrencyUtil.java:208) at com.intellij.util.io.BaseDataReader.lambda$start$0(BaseDataReader.java:61) at com.intellij.util.io.BaseDataReader$$Lambda$366/0x0000000840603440.run(Unknown Source) at java.util.concurrent.Executors$RunnableAdapter.call(java.base@11.0.3/Executors.java:515) at java.util.concurrent.FutureTask.run(java.base@11.0.3/FutureTask.java:264) at java.util.concurrent.ThreadPoolExecutor.runWorker(java.base@11.0.3/ThreadPoolExecutor.java:1128) at java.util.concurrent.ThreadPoolExecutor$Worker.run(java.base@11.0.3/ThreadPoolExecutor.java:628) at java.lang.Thread.run(java.base@11.0.3/Thread.java:834) "Netty Builtin Server 2" #32 prio=4 os_prio=-1 cpu=31.25ms elapsed=8415.08s tid=0x000000001dd61800 nid=0xecc runnable [0x0000000025a1f000] java.lang.Thread.State: RUNNABLE at sun.nio.ch.WindowsSelectorImpl$SubSelector.poll0(java.base@11.0.3/Native Method) at sun.nio.ch.WindowsSelectorImpl$SubSelector.poll(java.base@11.0.3/WindowsSelectorImpl.java:339) at sun.nio.ch.WindowsSelectorImpl.doSelect(java.base@11.0.3/WindowsSelectorImpl.java:167) at sun.nio.ch.SelectorImpl.lockAndDoSelect(java.base@11.0.3/SelectorImpl.java:124) - locked <0x00000000e2060e88> (a io.netty.channel.nio.SelectedSelectionKeySet) - locked <0x00000000e18e9f70> (a sun.nio.ch.WindowsSelectorImpl) at sun.nio.ch.SelectorImpl.select(java.base@11.0.3/SelectorImpl.java:136) at io.netty.channel.nio.SelectedSelectionKeySetSelector.select(SelectedSelectionKeySetSelector.java:62) at io.netty.channel.nio.NioEventLoop.select(NioEventLoop.java:806) at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:454) at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:918) at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74) at java.lang.Thread.run(java.base@11.0.3/Thread.java:834) "pool-1-thread-1" #33 prio=5 os_prio=0 cpu=125.00ms elapsed=8405.03s tid=0x000000001fc34000 nid=0x2b98 runnable [0x000000002695f000] java.lang.Thread.State: TIMED_WAITING (parking) at jdk.internal.misc.Unsafe.park(java.base@11.0.3/Native Method) - parking to wait for <0x00000000e24eaab0> (a java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject) at java.util.concurrent.locks.LockSupport.parkNanos(java.base@11.0.3/LockSupport.java:234) at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.awaitNanos(java.base@11.0.3/AbstractQueuedSynchronizer.java:2123) at java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(java.base@11.0.3/ScheduledThreadPoolExecutor.java:1182) at java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(java.base@11.0.3/ScheduledThreadPoolExecutor.java:899) at java.util.concurrent.ThreadPoolExecutor.getTask(java.base@11.0.3/ThreadPoolExecutor.java:1054) at java.util.concurrent.ThreadPoolExecutor.runWorker(java.base@11.0.3/ThreadPoolExecutor.java:1114) at java.util.concurrent.ThreadPoolExecutor$Worker.run(java.base@11.0.3/ThreadPoolExecutor.java:628) at java.lang.Thread.run(java.base@11.0.3/Thread.java:834) "TimerQueue" #34 daemon prio=5 os_prio=0 cpu=15.63ms elapsed=8402.20s tid=0x0000000024d3a000 nid=0x7fb0 waiting on condition [0x000000002974f000] java.lang.Thread.State: TIMED_WAITING (parking) at jdk.internal.misc.Unsafe.park(java.base@11.0.3/Native Method) - parking to wait for <0x00000000e565e370> (a java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject) at java.util.concurrent.locks.LockSupport.parkNanos(java.base@11.0.3/LockSupport.java:234) at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.awaitNanos(java.base@11.0.3/AbstractQueuedSynchronizer.java:2123) at java.util.concurrent.DelayQueue.take(java.base@11.0.3/DelayQueue.java:229) at javax.swing.TimerQueue.run(java.desktop@11.0.3/TimerQueue.java:171) at java.lang.Thread.run(java.base@11.0.3/Thread.java:834) "Netty Builtin Server 3" #44 prio=4 os_prio=-1 cpu=46.88ms elapsed=8359.83s tid=0x0000000031674800 nid=0x7994 runnable [0x000000003729f000] java.lang.Thread.State: RUNNABLE at sun.nio.ch.WindowsSelectorImpl$SubSelector.poll0(java.base@11.0.3/Native Method) at sun.nio.ch.WindowsSelectorImpl$SubSelector.poll(java.base@11.0.3/WindowsSelectorImpl.java:339) at sun.nio.ch.WindowsSelectorImpl.doSelect(java.base@11.0.3/WindowsSelectorImpl.java:167) at sun.nio.ch.SelectorImpl.lockAndDoSelect(java.base@11.0.3/SelectorImpl.java:124) - locked <0x00000000e2061398> (a io.netty.channel.nio.SelectedSelectionKeySet) - locked <0x00000000e18e9ff8> (a sun.nio.ch.WindowsSelectorImpl) at sun.nio.ch.SelectorImpl.select(java.base@11.0.3/SelectorImpl.java:136) at io.netty.channel.nio.SelectedSelectionKeySetSelector.select(SelectedSelectionKeySetSelector.java:62) at io.netty.channel.nio.NioEventLoop.select(NioEventLoop.java:806) at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:454) at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:918) at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74) at java.lang.Thread.run(java.base@11.0.3/Thread.java:834) "java.exe" #59 prio=4 os_prio=-1 cpu=0.00ms elapsed=8326.94s tid=0x0000000038b6d800 nid=0xa67c runnable [0x000000003ea7e000] java.lang.Thread.State: RUNNABLE at java.lang.ProcessImpl.waitForInterruptibly(java.base@11.0.3/Native Method) at java.lang.ProcessImpl.waitFor(java.base@11.0.3/ProcessImpl.java:484) at com.intellij.execution.process.ProcessWaitFor.lambda$null$0(ProcessWaitFor.java:48) at com.intellij.execution.process.ProcessWaitFor$$Lambda$368/0x0000000840605840.run(Unknown Source) at com.intellij.util.ConcurrencyUtil.runUnderThreadName(ConcurrencyUtil.java:208) at com.intellij.execution.process.ProcessWaitFor.lambda$new$1(ProcessWaitFor.java:43) at com.intellij.execution.process.ProcessWaitFor$$Lambda$365/0x0000000840603040.run(Unknown Source) at java.util.concurrent.Executors$RunnableAdapter.call(java.base@11.0.3/Executors.java:515) at java.util.concurrent.FutureTask.run(java.base@11.0.3/FutureTask.java:264) at java.util.concurrent.ThreadPoolExecutor.runWorker(java.base@11.0.3/ThreadPoolExecutor.java:1128) at java.util.concurrent.ThreadPoolExecutor$Worker.run(java.base@11.0.3/ThreadPoolExecutor.java:628) at java.lang.Thread.run(java.base@11.0.3/Thread.java:834) "BaseDataReader: output stream of java.exe" #60 prio=4 os_prio=-1 cpu=31.25ms elapsed=8326.90s tid=0x0000000038b83800 nid=0xf930 runnable [0x0000000042a9e000] java.lang.Thread.State: RUNNABLE at java.io.FileInputStream.readBytes(java.base@11.0.3/Native Method) at java.io.FileInputStream.read(java.base@11.0.3/FileInputStream.java:279) at java.io.BufferedInputStream.read1(java.base@11.0.3/BufferedInputStream.java:290) at java.io.BufferedInputStream.read(java.base@11.0.3/BufferedInputStream.java:351) - locked <0x00000000e75e9428> (a java.io.BufferedInputStream) at sun.nio.cs.StreamDecoder.readBytes(java.base@11.0.3/StreamDecoder.java:284) at sun.nio.cs.StreamDecoder.implRead(java.base@11.0.3/StreamDecoder.java:326) at sun.nio.cs.StreamDecoder.read(java.base@11.0.3/StreamDecoder.java:178) - locked <0x00000000e76db578> (a com.intellij.util.io.BaseInputStreamReader) at java.io.InputStreamReader.read(java.base@11.0.3/InputStreamReader.java:185) at java.io.Reader.read(java.base@11.0.3/Reader.java:229) at com.intellij.util.io.BaseOutputReader.readAvailableBlocking(BaseOutputReader.java:146) at com.intellij.util.io.BaseDataReader.readAvailable(BaseDataReader.java:77) at com.intellij.util.io.BaseDataReader.doRun(BaseDataReader.java:155) at com.intellij.util.io.BaseDataReader$$Lambda$369/0x0000000840605c40.run(Unknown Source) at com.intellij.util.ConcurrencyUtil.runUnderThreadName(ConcurrencyUtil.java:208) at com.intellij.util.io.BaseDataReader.lambda$start$0(BaseDataReader.java:61) at com.intellij.util.io.BaseDataReader$$Lambda$366/0x0000000840603440.run(Unknown Source) at java.util.concurrent.Executors$RunnableAdapter.call(java.base@11.0.3/Executors.java:515) at java.util.concurrent.FutureTask.run(java.base@11.0.3/FutureTask.java:264) at java.util.concurrent.ThreadPoolExecutor.runWorker(java.base@11.0.3/ThreadPoolExecutor.java:1128) at java.util.concurrent.ThreadPoolExecutor$Worker.run(java.base@11.0.3/ThreadPoolExecutor.java:628) at java.lang.Thread.run(java.base@11.0.3/Thread.java:834) "BaseDataReader: error stream of java.exe" #61 prio=4 os_prio=-1 cpu=0.00ms elapsed=8326.90s tid=0x0000000038b8f800 nid=0xc02c runnable [0x0000000042fbe000] java.lang.Thread.State: RUNNABLE at java.io.FileInputStream.readBytes(java.base@11.0.3/Native Method) at java.io.FileInputStream.read(java.base@11.0.3/FileInputStream.java:279) at sun.nio.cs.StreamDecoder.readBytes(java.base@11.0.3/StreamDecoder.java:284) at sun.nio.cs.StreamDecoder.implRead(java.base@11.0.3/StreamDecoder.java:326) at sun.nio.cs.StreamDecoder.read(java.base@11.0.3/StreamDecoder.java:178) - locked <0x00000000e76db478> (a com.intellij.util.io.BaseInputStreamReader) at java.io.InputStreamReader.read(java.base@11.0.3/InputStreamReader.java:185) at java.io.Reader.read(java.base@11.0.3/Reader.java:229) at com.intellij.util.io.BaseOutputReader.readAvailableBlocking(BaseOutputReader.java:146) at com.intellij.util.io.BaseDataReader.readAvailable(BaseDataReader.java:77) at com.intellij.util.io.BaseDataReader.doRun(BaseDataReader.java:155) at com.intellij.util.io.BaseDataReader$$Lambda$369/0x0000000840605c40.run(Unknown Source) at com.intellij.util.ConcurrencyUtil.runUnderThreadName(ConcurrencyUtil.java:208) at com.intellij.util.io.BaseDataReader.lambda$start$0(BaseDataReader.java:61) at com.intellij.util.io.BaseDataReader$$Lambda$366/0x0000000840603440.run(Unknown Source) at java.util.concurrent.Executors$RunnableAdapter.call(java.base@11.0.3/Executors.java:515) at java.util.concurrent.FutureTask.run(java.base@11.0.3/FutureTask.java:264) at java.util.concurrent.ThreadPoolExecutor.runWorker(java.base@11.0.3/ThreadPoolExecutor.java:1128) at java.util.concurrent.ThreadPoolExecutor$Worker.run(java.base@11.0.3/ThreadPoolExecutor.java:628) at java.lang.Thread.run(java.base@11.0.3/Thread.java:834) "RMI TCP Accept-0" #62 daemon prio=4 os_prio=-1 cpu=140.63ms elapsed=8323.37s tid=0x0000000038b8b000 nid=0x1c858 runnable [0x00000000428af000] java.lang.Thread.State: RUNNABLE at java.net.PlainSocketImpl.accept0(java.base@11.0.3/Native Method) at java.net.PlainSocketImpl.socketAccept(java.base@11.0.3/PlainSocketImpl.java:159) at java.net.AbstractPlainSocketImpl.accept(java.base@11.0.3/AbstractPlainSocketImpl.java:458) at java.net.ServerSocket.implAccept(java.base@11.0.3/ServerSocket.java:551) at java.net.ServerSocket.accept(java.base@11.0.3/ServerSocket.java:519) at sun.rmi.transport.tcp.TCPTransport$AcceptLoop.executeAcceptLoop(java.rmi@11.0.3/TCPTransport.java:394) at sun.rmi.transport.tcp.TCPTransport$AcceptLoop.run(java.rmi@11.0.3/TCPTransport.java:366) at java.lang.Thread.run(java.base@11.0.3/Thread.java:834) "RMI Reaper" #63 prio=4 os_prio=-1 cpu=0.00ms elapsed=8323.36s tid=0x0000000038b92000 nid=0x1969c in Object.wait() [0x0000000042dcf000] java.lang.Thread.State: WAITING (on object monitor) at java.lang.Object.wait(java.base@11.0.3/Native Method) - waiting on <0x00000000e74beaf8> (a java.lang.ref.ReferenceQueue$Lock) at java.lang.ref.ReferenceQueue.remove(java.base@11.0.3/ReferenceQueue.java:155) - waiting to re-lock in wait() <0x00000000e74beaf8> (a java.lang.ref.ReferenceQueue$Lock) at java.lang.ref.ReferenceQueue.remove(java.base@11.0.3/ReferenceQueue.java:176) at sun.rmi.transport.ObjectTable$Reaper.run(java.rmi@11.0.3/ObjectTable.java:349) at java.lang.Thread.run(java.base@11.0.3/Thread.java:834) "RMI GC Daemon" #64 daemon prio=2 os_prio=-2 cpu=0.00ms elapsed=8323.36s tid=0x0000000038b97000 nid=0xb140 in Object.wait() [0x000000004448f000] java.lang.Thread.State: TIMED_WAITING (on object monitor) at java.lang.Object.wait(java.base@11.0.3/Native Method) - waiting on <no object reference available> at sun.rmi.transport.GC$Daemon.run(java.rmi@11.0.3/GC.java:126) - waiting to re-lock in wait() <0x00000000e7754e88> (a sun.rmi.transport.GC$LatencyLock) at java.lang.Thread.run(java.base@11.0.3/Thread.java:834) at jdk.internal.misc.InnocuousThread.run(java.base@11.0.3/InnocuousThread.java:134) "RMI Scheduler(0)" #65 daemon prio=4 os_prio=-1 cpu=46.88ms elapsed=8323.32s tid=0x0000000038b98000 nid=0x156a0 waiting on condition [0x000000004458f000] java.lang.Thread.State: TIMED_WAITING (parking) at jdk.internal.misc.Unsafe.park(java.base@11.0.3/Native Method) - parking to wait for <0x00000000e74bef78> (a java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject) at java.util.concurrent.locks.LockSupport.parkNanos(java.base@11.0.3/LockSupport.java:234) at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.awaitNanos(java.base@11.0.3/AbstractQueuedSynchronizer.java:2123) at java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(java.base@11.0.3/ScheduledThreadPoolExecutor.java:1182) at java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(java.base@11.0.3/ScheduledThreadPoolExecutor.java:899) at java.util.concurrent.ThreadPoolExecutor.getTask(java.base@11.0.3/ThreadPoolExecutor.java:1054) at java.util.concurrent.ThreadPoolExecutor.runWorker(java.base@11.0.3/ThreadPoolExecutor.java:1114) at java.util.concurrent.ThreadPoolExecutor$Worker.run(java.base@11.0.3/ThreadPoolExecutor.java:628) at java.lang.Thread.run(java.base@11.0.3/Thread.java:834) "RMI RenewClean-[127.0.0.1:41158]" #66 daemon prio=4 os_prio=-1 cpu=265.63ms elapsed=8323.23s tid=0x0000000038b98800 nid=0x8788 in Object.wait() [0x000000004468f000] java.lang.Thread.State: TIMED_WAITING (on object monitor) at java.lang.Object.wait(java.base@11.0.3/Native Method) - waiting on <no object reference available> at java.lang.ref.ReferenceQueue.remove(java.base@11.0.3/ReferenceQueue.java:155) - waiting to re-lock in wait() <0x00000000e7754f30> (a java.lang.ref.ReferenceQueue$Lock) at sun.rmi.transport.DGCClient$EndpointEntry$RenewCleanThread.run(java.rmi@11.0.3/DGCClient.java:558) at java.lang.Thread.run(java.base@11.0.3/Thread.java:834) "RMI TCP Connection(idle)" #68 daemon prio=4 os_prio=-1 cpu=718.75ms elapsed=8323.12s tid=0x0000000038b9a800 nid=0x3e1c waiting on condition [0x0000000044a8f000] java.lang.Thread.State: TIMED_WAITING (parking) at jdk.internal.misc.Unsafe.park(java.base@11.0.3/Native Method) - parking to wait for <0x00000000e77550f8> (a java.util.concurrent.SynchronousQueue$TransferStack) at java.util.concurrent.locks.LockSupport.parkNanos(java.base@11.0.3/LockSupport.java:234) at java.util.concurrent.SynchronousQueue$TransferStack.awaitFulfill(java.base@11.0.3/SynchronousQueue.java:462) at java.util.concurrent.SynchronousQueue$TransferStack.transfer(java.base@11.0.3/SynchronousQueue.java:361) at java.util.concurrent.SynchronousQueue.poll(java.base@11.0.3/SynchronousQueue.java:937) at java.util.concurrent.ThreadPoolExecutor.getTask(java.base@11.0.3/ThreadPoolExecutor.java:1053) at java.util.concurrent.ThreadPoolExecutor.runWorker(java.base@11.0.3/ThreadPoolExecutor.java:1114) at java.util.concurrent.ThreadPoolExecutor$Worker.run(java.base@11.0.3/ThreadPoolExecutor.java:628) at java.lang.Thread.run(java.base@11.0.3/Thread.java:834) "DefaultDispatcher-worker-1" #118 daemon prio=4 os_prio=-1 cpu=125.00ms elapsed=7870.85s tid=0x000000004e0c8000 nid=0x18478 waiting on condition [0x00000000457cf000] java.lang.Thread.State: TIMED_WAITING (parking) at jdk.internal.misc.Unsafe.park(java.base@11.0.3/Native Method) at java.util.concurrent.locks.LockSupport.parkNanos(java.base@11.0.3/LockSupport.java:357) at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.doPark(CoroutineScheduler.kt:850) at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.cpuWorkerIdle(CoroutineScheduler.kt:823) at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:729) "DefaultDispatcher-worker-2" #119 daemon prio=4 os_prio=-1 cpu=0.00ms elapsed=7870.85s tid=0x000000004e0ce800 nid=0x19ea4 waiting on condition [0x00000000483af000] java.lang.Thread.State: TIMED_WAITING (parking) at jdk.internal.misc.Unsafe.park(java.base@11.0.3/Native Method) at java.util.concurrent.locks.LockSupport.parkNanos(java.base@11.0.3/LockSupport.java:357) at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.doPark(CoroutineScheduler.kt:850) at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.cpuWorkerIdle(CoroutineScheduler.kt:823) at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:729) "DefaultDispatcher-worker-3" #120 daemon prio=4 os_prio=-1 cpu=0.00ms elapsed=7870.84s tid=0x000000004e0d1000 nid=0x5d84 waiting on condition [0x0000000056f7f000] java.lang.Thread.State: TIMED_WAITING (parking) at jdk.internal.misc.Unsafe.park(java.base@11.0.3/Native Method) at java.util.concurrent.locks.LockSupport.parkNanos(java.base@11.0.3/LockSupport.java:357) at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.doPark(CoroutineScheduler.kt:850) at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.cpuWorkerIdle(CoroutineScheduler.kt:823) at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:729) "DefaultDispatcher-worker-4" #128 daemon prio=4 os_prio=-1 cpu=0.00ms elapsed=7832.04s tid=0x000000004e0e0800 nid=0x77b0 waiting on condition [0x000000005788f000] java.lang.Thread.State: TIMED_WAITING (parking) at jdk.internal.misc.Unsafe.park(java.base@11.0.3/Native Method) at java.util.concurrent.locks.LockSupport.parkNanos(java.base@11.0.3/LockSupport.java:357) at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.doPark(CoroutineScheduler.kt:850) at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.cpuWorkerIdle(CoroutineScheduler.kt:823) at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:729) "java.exe" #169 prio=4 os_prio=-1 cpu=0.00ms elapsed=7157.24s tid=0x0000000054720800 nid=0x31fc runnable [0x000000001ed6f000] java.lang.Thread.State: RUNNABLE at java.lang.ProcessImpl.waitForInterruptibly(java.base@11.0.3/Native Method) at java.lang.ProcessImpl.waitFor(java.base@11.0.3/ProcessImpl.java:484) at com.intellij.execution.process.ProcessWaitFor.lambda$null$0(ProcessWaitFor.java:48) at com.intellij.execution.process.ProcessWaitFor$$Lambda$368/0x0000000840605840.run(Unknown Source) at com.intellij.util.ConcurrencyUtil.runUnderThreadName(ConcurrencyUtil.java:208) at com.intellij.execution.process.ProcessWaitFor.lambda$new$1(ProcessWaitFor.java:43) at com.intellij.execution.process.ProcessWaitFor$$Lambda$365/0x0000000840603040.run(Unknown Source) at java.util.concurrent.Executors$RunnableAdapter.call(java.base@11.0.3/Executors.java:515) at java.util.concurrent.FutureTask.run(java.base@11.0.3/FutureTask.java:264) at java.util.concurrent.ThreadPoolExecutor.runWorker(java.base@11.0.3/ThreadPoolExecutor.java:1128) at java.util.concurrent.ThreadPoolExecutor$Worker.run(java.base@11.0.3/ThreadPoolExecutor.java:628) at java.lang.Thread.run(java.base@11.0.3/Thread.java:834) "BaseDataReader: error stream of java.exe" #170 prio=4 os_prio=-1 cpu=0.00ms elapsed=7157.24s tid=0x0000000054720000 nid=0x8368 runnable [0x000000002a79e000] java.lang.Thread.State: RUNNABLE at java.io.FileInputStream.readBytes(java.base@11.0.3/Native Method) at java.io.FileInputStream.read(java.base@11.0.3/FileInputStream.java:279) at sun.nio.cs.StreamDecoder.readBytes(java.base@11.0.3/StreamDecoder.java:284) at sun.nio.cs.StreamDecoder.implRead(java.base@11.0.3/StreamDecoder.java:326) at sun.nio.cs.StreamDecoder.read(java.base@11.0.3/StreamDecoder.java:178) - locked <0x00000000e9ec1668> (a com.intellij.util.io.BaseInputStreamReader) at java.io.InputStreamReader.read(java.base@11.0.3/InputStreamReader.java:185) at java.io.Reader.read(java.base@11.0.3/Reader.java:229) at com.intellij.util.io.BaseOutputReader.readAvailableBlocking(BaseOutputReader.java:146) at com.intellij.util.io.BaseDataReader.readAvailable(BaseDataReader.java:77) at com.intellij.util.io.BaseDataReader.doRun(BaseDataReader.java:155) at com.intellij.util.io.BaseDataReader$$Lambda$369/0x0000000840605c40.run(Unknown Source) at com.intellij.util.ConcurrencyUtil.runUnderThreadName(ConcurrencyUtil.java:208) at com.intellij.util.io.BaseDataReader.lambda$start$0(BaseDataReader.java:61) at com.intellij.util.io.BaseDataReader$$Lambda$366/0x0000000840603440.run(Unknown Source) at java.util.concurrent.Executors$RunnableAdapter.call(java.base@11.0.3/Executors.java:515) at java.util.concurrent.FutureTask.run(java.base@11.0.3/FutureTask.java:264) at java.util.concurrent.ThreadPoolExecutor.runWorker(java.base@11.0.3/ThreadPoolExecutor.java:1128) at java.util.concurrent.ThreadPoolExecutor$Worker.run(java.base@11.0.3/ThreadPoolExecutor.java:628) at java.lang.Thread.run(java.base@11.0.3/Thread.java:834) "BaseDataReader: output stream of java.exe" #171 prio=4 os_prio=-1 cpu=0.00ms elapsed=7157.24s tid=0x000000005471d800 nid=0x1e08c runnable [0x000000002f81e000] java.lang.Thread.State: RUNNABLE at java.io.FileInputStream.readBytes(java.base@11.0.3/Native Method) at java.io.FileInputStream.read(java.base@11.0.3/FileInputStream.java:279) at java.io.BufferedInputStream.read1(java.base@11.0.3/BufferedInputStream.java:290) at java.io.BufferedInputStream.read(java.base@11.0.3/BufferedInputStream.java:351) - locked <0x00000000e9e328e8> (a java.io.BufferedInputStream) at sun.nio.cs.StreamDecoder.readBytes(java.base@11.0.3/StreamDecoder.java:284) at sun.nio.cs.StreamDecoder.implRead(java.base@11.0.3/StreamDecoder.java:326) at sun.nio.cs.StreamDecoder.read(java.base@11.0.3/StreamDecoder.java:178) - locked <0x00000000e9e32940> (a com.intellij.util.io.BaseInputStreamReader) at java.io.InputStreamReader.read(java.base@11.0.3/InputStreamReader.java:185) at java.io.Reader.read(java.base@11.0.3/Reader.java:229) at com.intellij.util.io.BaseOutputReader.readAvailableBlocking(BaseOutputReader.java:146) at com.intellij.util.io.BaseDataReader.readAvailable(BaseDataReader.java:77) at com.intellij.util.io.BaseDataReader.doRun(BaseDataReader.java:155) at com.intellij.util.io.BaseDataReader$$Lambda$369/0x0000000840605c40.run(Unknown Source) at com.intellij.util.ConcurrencyUtil.runUnderThreadName(ConcurrencyUtil.java:208) at com.intellij.util.io.BaseDataReader.lambda$start$0(BaseDataReader.java:61) at com.intellij.util.io.BaseDataReader$$Lambda$366/0x0000000840603440.run(Unknown Source) at java.util.concurrent.Executors$RunnableAdapter.call(java.base@11.0.3/Executors.java:515) at java.util.concurrent.FutureTask.run(java.base@11.0.3/FutureTask.java:264) at java.util.concurrent.ThreadPoolExecutor.runWorker(java.base@11.0.3/ThreadPoolExecutor.java:1128) at java.util.concurrent.ThreadPoolExecutor$Worker.run(java.base@11.0.3/ThreadPoolExecutor.java:628) at java.lang.Thread.run(java.base@11.0.3/Thread.java:834) "JobScheduler FJ pool 4/3" #246 daemon prio=4 os_prio=-1 cpu=828.13ms elapsed=1447.77s tid=0x0000000054739000 nid=0x161b4 waiting on condition [0x0000000044d8f000] java.lang.Thread.State: WAITING (parking) at jdk.internal.misc.Unsafe.park(java.base@11.0.3/Native Method) - parking to wait for <0x00000000e0e26ae8> (a java.util.concurrent.ForkJoinPool) at java.util.concurrent.locks.LockSupport.park(java.base@11.0.3/LockSupport.java:194) at java.util.concurrent.ForkJoinPool.runWorker(java.base@11.0.3/ForkJoinPool.java:1628) at java.util.concurrent.ForkJoinWorkerThread.run(java.base@11.0.3/ForkJoinWorkerThread.java:177) "ApplicationImpl pooled thread 108" #271 prio=4 os_prio=-1 cpu=93.75ms elapsed=693.08s tid=0x000000005471b800 nid=0x17864 waiting on condition [0x000000001ec6f000] java.lang.Thread.State: TIMED_WAITING (parking) at jdk.internal.misc.Unsafe.park(java.base@11.0.3/Native Method) - parking to wait for <0x00000000e11ed0c8> (a java.util.concurrent.SynchronousQueue$TransferStack) at java.util.concurrent.locks.LockSupport.parkNanos(java.base@11.0.3/LockSupport.java:234) at java.util.concurrent.SynchronousQueue$TransferStack.awaitFulfill(java.base@11.0.3/SynchronousQueue.java:462) at java.util.concurrent.SynchronousQueue$TransferStack.transfer(java.base@11.0.3/SynchronousQueue.java:361) at java.util.concurrent.SynchronousQueue.poll(java.base@11.0.3/SynchronousQueue.java:937) at java.util.concurrent.ThreadPoolExecutor.getTask(java.base@11.0.3/ThreadPoolExecutor.java:1053) at java.util.concurrent.ThreadPoolExecutor.runWorker(java.base@11.0.3/ThreadPoolExecutor.java:1114) at java.util.concurrent.ThreadPoolExecutor$Worker.run(java.base@11.0.3/ThreadPoolExecutor.java:628) at java.lang.Thread.run(java.base@11.0.3/Thread.java:834) "JobScheduler FJ pool 0/3" #278 daemon prio=4 os_prio=-1 cpu=187.50ms elapsed=88.30s tid=0x0000000054726800 nid=0x161bc waiting on condition [0x000000002a9af000] java.lang.Thread.State: TIMED_WAITING (parking) at jdk.internal.misc.Unsafe.park(java.base@11.0.3/Native Method) - parking to wait for <0x00000000e0e26ae8> (a java.util.concurrent.ForkJoinPool) at java.util.concurrent.locks.LockSupport.parkUntil(java.base@11.0.3/LockSupport.java:275) at java.util.concurrent.ForkJoinPool.runWorker(java.base@11.0.3/ForkJoinPool.java:1619) at java.util.concurrent.ForkJoinWorkerThread.run(java.base@11.0.3/ForkJoinWorkerThread.java:177) "Swing-Shell" #281 daemon prio=10 os_prio=2 cpu=203.13ms elapsed=87.00s tid=0x000000005472b000 nid=0x15ae8 waiting on condition [0x00000000379af000] java.lang.Thread.State: WAITING (parking) at jdk.internal.misc.Unsafe.park(java.base@11.0.3/Native Method) - parking to wait for <0x00000000d509e3a8> (a java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject) at java.util.concurrent.locks.LockSupport.park(java.base@11.0.3/LockSupport.java:194) at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(java.base@11.0.3/AbstractQueuedSynchronizer.java:2081) at java.util.concurrent.LinkedBlockingQueue.take(java.base@11.0.3/LinkedBlockingQueue.java:433) at java.util.concurrent.ThreadPoolExecutor.getTask(java.base@11.0.3/ThreadPoolExecutor.java:1054) at java.util.concurrent.ThreadPoolExecutor.runWorker(java.base@11.0.3/ThreadPoolExecutor.java:1114) at java.util.concurrent.ThreadPoolExecutor$Worker.run(java.base@11.0.3/ThreadPoolExecutor.java:628) at sun.awt.shell.Win32ShellFolderManager2$ComInvoker$1.run(java.desktop@11.0.3/Win32ShellFolderManager2.java:557) at java.lang.Thread.run(java.base@11.0.3/Thread.java:834) "ApplicationImpl pooled thread 115" #284 prio=4 os_prio=-1 cpu=0.00ms elapsed=17.07s tid=0x000000005471c800 nid=0x114c0 waiting on condition [0x000000001eb6f000] java.lang.Thread.State: TIMED_WAITING (parking) at jdk.internal.misc.Unsafe.park(java.base@11.0.3/Native Method) - parking to wait for <0x00000000e11ed0c8> (a java.util.concurrent.SynchronousQueue$TransferStack) at java.util.concurrent.locks.LockSupport.parkNanos(java.base@11.0.3/LockSupport.java:234) at java.util.concurrent.SynchronousQueue$TransferStack.awaitFulfill(java.base@11.0.3/SynchronousQueue.java:462) at java.util.concurrent.SynchronousQueue$TransferStack.transfer(java.base@11.0.3/SynchronousQueue.java:361) at java.util.concurrent.SynchronousQueue.poll(java.base@11.0.3/SynchronousQueue.java:937) at java.util.concurrent.ThreadPoolExecutor.getTask(java.base@11.0.3/ThreadPoolExecutor.java:1053) at java.util.concurrent.ThreadPoolExecutor.runWorker(java.base@11.0.3/ThreadPoolExecutor.java:1114) at java.util.concurrent.ThreadPoolExecutor$Worker.run(java.base@11.0.3/ThreadPoolExecutor.java:628) at java.lang.Thread.run(java.base@11.0.3/Thread.java:834) "VM Thread" os_prio=2 cpu=3203.13ms elapsed=8453.70s tid=0x000000000270e800 nid=0xc0b0 runnable "GC Thread#0" os_prio=2 cpu=1453.13ms elapsed=8454.61s tid=0x0000000002651000 nid=0x1dd20 runnable "GC Thread#1" os_prio=2 cpu=1468.75ms elapsed=8448.55s tid=0x0000000019f8d800 nid=0x279c runnable "GC Thread#2" os_prio=2 cpu=1406.25ms elapsed=8443.64s tid=0x000000001b7e5800 nid=0xeed4 runnable "GC Thread#3" os_prio=2 cpu=1421.88ms elapsed=8443.64s tid=0x000000001b7e0800 nid=0x1b6c4 runnable "CMS Main Thread" os_prio=2 cpu=6078.13ms elapsed=8454.57s tid=0x0000000002694000 nid=0x13f84 runnable "VM Periodic Task Thread" os_prio=2 cpu=343.75ms elapsed=8450.69s tid=0x0000000019be1800 nid=0x1c984 waiting on condition JNI global refs: 141, weak refs: 1707
二、线程的状态
在Java中线程的状态一共被分成6种:
1、初始态(NEW)
创建一个Thread对象,但还未调用start()启动线程时,线程处于初始态。
2、运行态(RUNNABLE)
在Java中,运行态包括 就绪态 和 运行态。①就绪态
该状态下的线程已经获得执行所需的所有资源,只要CPU分配执行权就能运行。
所有就绪态的线程存放在就绪队列中。
②运行态
获得CPU执行权,正在执行的线程。
由于一个CPU同一时刻只能执行一条线程,因此每个CPU每个时刻只有一条运行态的线程。
3、阻塞态(BLOCKED)
当一条正在执行的线程请求某一资源失败时,就会进入阻塞态。
而在Java中,阻塞态专指请求锁失败时进入的状态。
由一个阻塞队列存放所有阻塞态的线程。
处于阻塞态的线程会不断请求资源,一旦请求成功,就会进入就绪队列,等待执行。
4、等待态(WAITING)
当前线程中调用wait、join、park函数时,当前线程就会进入等待态。
也有一个等待队列存放所有等待态的线程。
线程处于等待态表示它需要等待其他线程的指示才能继续运行。
进入等待态的线程会释放CPU执行权,并释放资源(如:锁)
5、超时等待态(TIMED_WAITING)
当运行中的线程调用sleep(time)、wait、join、parkNanos、parkUntil时,就会进入该状态;
它和等待态一样,并不是因为请求不到资源,而是主动进入,并且进入后需要其他线程唤醒;
进入该状态后释放CPU执行权 和 占有的资源。
与等待态的区别:到了超时时间后自动进入阻塞队列,开始竞争锁。
6、终止态(TERMINATED)
线程执行结束后的状态。
三、死锁问题
如果在生产环境发生了死锁,我们将看到的是部署的程序没有任何反应了,这个时候我们可以借助jstack进行分析
1、构造死锁
编写代码,启动2个线程,Thread1拿到了obj1锁,准备去拿obj2锁时,obj2已经被Thread2锁定,所以发送了死锁。
package com.zn; public class LockTest { //定义资源 private static Object obj1=new Object(); private static Object obj2=new Object(); //线程A:先获取到资源1,然后休眠2s,再获取资源2 private static class ThreadA implements Runnable{ @Override public void run() { synchronized (obj1){ System.out.println("ThreadA获取到了OBJ1资源"); try { //休眠2s,因为我们要将CPU资源让渡出去,这样线程B就可以先抢占obj2资源 Thread.sleep(2000); } catch (InterruptedException e) { e.printStackTrace(); } synchronized (obj2){ System.out.println("ThreadA获取到了OBJ2资源"); } } } }
private static class ThreadB implements Runnable{ @Override public void run() { synchronized (obj2){ System.out.println("ThreadB获取到了OBJ2资源"); try { //休眠2s,因为我们要将CPU资源让渡出去,这样线程B就可以先抢占obj2资源 Thread.sleep(2000); } catch (InterruptedException e) { e.printStackTrace(); } synchronized (obj1){ System.out.println("ThreadA获取到了OBJ1资源"); } } } } public static void main(String[] args) { new Thread(new ThreadA()).start(); new Thread(new ThreadB()).start(); } }
控制台状态:
2、使用jstack进行分析
jstack 40360
可以清晰的看到:
Thread2获取了 <0x00000000d5e8f4d0> 的锁,等待获取 <0x00000000d5e8f4c0> 这个锁
Thread1获取了 <0x00000000d5e8f4c0> 的锁,等待获取 <0x00000000d5e8f4d0> 这个锁
由此可见,发生了死锁。