乐趣区

关于java:JVM虚拟机性能监控与故障处理工具

定位线上问题时,常识和教训是要害根底,数据是根据,数据包含运行日志,异样堆栈,GC 日志,线程快照 (threaddump/javacore 文件),堆转储快照(headdump/hprof 文件) 等

JDK 监控和故障解决工具

命令 作用
jps 显示指定零碎内所有 HotSpot 虚拟机过程
jstat 收集 HotSpot 虚拟机各方面运行数据
jinfo 显示虚拟机配置信息
jmap 生成虚拟机的外部转储快照(heapdump 文件)
jhat 剖析 heapdump 文件
jstack 显示虚拟机线程快照

jps:虚拟机过程情况工具

显示指定零碎内所有 HotSpot 虚拟机过程

罕用选项

选项 作用
-q 只输入 LVMID
-m 输入虚拟机启动时传递给主类 main 函数的参数
-l 输入主类全名
-v 显示虚拟机启动时的 JVM 参数
[oracle@wcdev ~]$ jps
20560 Server
24748 Rcu
17387 Server
14824 Jps
20635 Server
27844 Server
10658 Server
5713 Server
10738 Server
6594 NodeManager
10705 Server
29681 Server
[oracle@wcdev ~]$ 

jstat:虚拟机统计信息监督工具

收集 HotSpot 虚拟机各方面运行数据

罕用选项

选项 作用
-class 监督类装载,卸载数量,总空间以及类装载所消耗的工夫
-gc 监督 JAVA 堆情况,包含 Eden 区,两个 survivor 区,老年代,永恒代等

查问过程 20560 的信息,1000 毫秒一次,执行 10 次

[oracle@wcdev ~]$ jstat -gc 20560 1000 10
HeapSize NurserySize UsedHeapSize   YC     OC    YCTime   OCTime   GCTime  YCPauseTime OCPauseTime PauseTime
4194304.0   1528649.8    1132960.1   2735    501  309.990  173.831  483.821     310.056     173.843   483.899
4194304.0   1528649.8    1132960.1   2735    501  309.990  173.831  483.821     310.056     173.843   483.899
4194304.0   1528649.8    1132960.1   2735    501  309.990  173.831  483.821     310.056     173.843   483.899
4194304.0   1528649.8    1132960.1   2735    501  309.990  173.831  483.821     310.056     173.843   483.899
4194304.0   1528649.8    1132960.1   2735    501  309.990  173.831  483.821     310.056     173.843   483.899
4194304.0   1528649.8    1132960.1   2735    501  309.990  173.831  483.821     310.056     173.843   483.899
4194304.0   1528649.8    1132960.1   2735    501  309.990  173.831  483.821     310.056     173.843   483.899
4194304.0   1528649.8    1132960.1   2735    501  309.990  173.831  483.821     310.056     173.843   483.899
4194304.0   1528649.8    1132960.1   2735    501  309.990  173.831  483.821     310.056     173.843   483.899
4194304.0   1528649.8    1132960.1   2735    501  309.990  173.831  483.821     310.056     173.843   483.899
[oracle@wcdev ~]$ 

jinfo:JAVA 配置信息工具

jinfo 能够查看和调整虚拟机各项参数,应用 jinfo 能够在不重启虚拟机的状况下,能够动静的批改 jvm 的参数

罕用选项

选项 作用
-flag 输入对应名称的参数
-flag [+/-]name 开启或者敞开对应名称的参数

jinfo pid

C:\Users\zero>jps -l
12080 com.example.offer.leecode.t20201015.CanJump
16112 sun.tools.jps.Jps
6292 org.jetbrains.idea.maven.server.RemoteMavenServer36
12940 org.jetbrains.kotlin.daemon.KotlinCompileDaemon
16284 org.jetbrains.jps.cmdline.Launcher
17388

C:\Users\zero>jinfo 12080
Attaching to process ID 12080, please wait...
Debugger attached successfully.
Server compiler detected.
JVM version is 25.102-b14
Java System Properties:

java.runtime.name = Java(TM) SE Runtime Environment
java.vm.version = 25.102-b14
sun.boot.library.path = C:\Program Files\Java\Java1.8.1\jre\bin
java.vendor.url = http://java.oracle.com/
java.vm.vendor = Oracle Corporation
path.separator = ;
file.encoding.pkg = sun.io
java.vm.name = Java HotSpot(TM) 64-Bit Server VM
sun.os.patch.level =
sun.java.launcher = SUN_STANDARD
user.script =
user.country = CN
user.dir = F:\GitCode\zero\TestExcel
java.vm.specification.name = Java Virtual Machine Specification
java.runtime.version = 1.8.0_102-b14
java.awt.graphicsenv = sun.awt.Win32GraphicsEnvironment
os.arch = amd64
java.endorsed.dirs = C:\Program Files\Java\Java1.8.1\jre\lib\endorsed
line.separator =

java.io.tmpdir = C:\Users\zero\AppData\Local\Temp\
java.vm.specification.vendor = Oracle Corporation
user.variant =
os.name = Windows 10
sun.jnu.encoding = GBK
java.library.path = C:\Program Files\Java\Java1.8.1\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;F:\oracleExe\app\oracle\product\11.2.0\server\bin;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Java\Java1.8.1\bin;C:\Program Files\TortoiseSVN\bin;F:\APP;F:\Git\Git\cmd;C:\Program Files\Redis\;F:\NvmFolder\nvm;F:\NvmFolder\nodejs;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;F:\Microsoft VS Code\Microsoft VS Code\bin;F:\Idea\IntelliJ IDEA 2017.1.1\plugins\maven\lib\maven3\bin;C:\Program Files\gradle\gradle-4.6\bin;F:\NvmFolder\nvm;F:\NvmFolder\nodejs;C:\Users\zero\AppData\Local\BypassRuntm;F:\NvmFolder\nvm;F:\NvmFolder\nodejs;F:\JetBrains\IntelliJ IDEA 2019.2.1\plugins\maven\lib\maven3\bin;.
java.specification.name = Java Platform API Specification
java.class.version = 52.0
sun.management.compiler = HotSpot 64-Bit Tiered Compilers
os.version = 10.0
user.home = C:\Users\zero
user.timezone = Asia/Shanghai
java.awt.printerjob = sun.awt.windows.WPrinterJob
file.encoding = UTF-8
java.specification.version = 1.8
user.name = zero
java.class.path = C:\Program Files\Java\Java1.8.1\jre\lib\charsets.jar;C:\Program Files\Java\Java1.8.1\jre\lib\deploy.jar;C:\Program Files\Java\Java1.8.1\jre\lib\ext\access-bridge-64.jar;C:\Program Files\Java\Java1.8.1\jre\lib\ext\cldrdata.jar;C:\Program Files\Java\Java1.8.1\jre\lib\ext\dnsns.jar;C:\Program Files\Java\Java1.8.1\jre\lib\ext\jaccess.jar;C:\Program Files\Java\Java1.8.1\jre\lib\ext\jfxrt.jar;C:\Program Files\Java\Java1.8.1\jre\lib\ext\localedata.jar;C:\Program Files\Java\Java1.8.1\jre\lib\ext\nashorn.jar;C:\Program Files\Java\Java1.8.1\jre\lib\ext\sunec.jar;C:\Program Files\Java\Java1.8.1\jre\lib\ext\sunjce_provider.jar;C:\Program Files\Java\Java1.8.1\jre\lib\ext\sunmscapi.jar;C:\Program Files\Java\Java1.8.1\jre\lib\ext\sunpkcs11.jar;C:\Program Files\Java\Java1.8.1\jre\lib\ext\zipfs.jar;C:\Program Files\Java\Java1.8.1\jre\lib\javaws.jar;C:\Program Files\Java\Java1.8.1\jre\lib\jce.jar;C:\Program Files\Java\Java1.8.1\jre\lib\jfr.jar;C:\Program Files\Java\Java1.8.1\jre\lib\jfxswt.jar;C:\Program Files\Java\Java1.8.1\jre\lib\jsse.jar;C:\Program Files\Java\Java1.8.1\jre\lib\management-agent.jar;C:\Program Files\Java\Java1.8.1\jre\lib\plugin.jar;C:\Program Files\Java\Java1.8.1\jre\lib\resources.jar;C:\Program Files\Java\Java1.8.1\jre\lib\rt.jar;F:\Jclasslib\jclasslib\jclasslib\bin\jclasslib.jar;F:\GitCode\zero\TestExcel\target\classes;F:\workSpace\Maven\repository\org\springframework\boot\spring-boot-starter-web\2.2.6.RELEASE\spring-boot-starter-web-2.2.6.RELEASE.jar;F:\workSpace\Maven\repository\org\springframework\boot\spring-boot-starter\2.2.6.RELEASE\spring-boot-starter-2.2.6.RELEASE.jar;F:\workSpace\Maven\repository\org\springframework\boot\spring-boot\2.2.6.RELEASE\spring-boot-2.2.6.RELEASE.jar;F:\workSpace\Maven\repository\org\springframework\boot\spring-boot-autoconfigure\2.2.6.RELEASE\spring-boot-autoconfigure-2.2.6.RELEASE.jar;F:\workSpace\Maven\repository\org\springframework\boot\spring-boot-starter-logging\2.2.6.RELEASE\spring-boot-starter-logging-2.2.6.RELEASE.jar;F:\workSpace\Maven\repository\ch\qos\logback\logback-classic\1.2.3\logback-classic-1.2.3.jar;F:\workSpace\Maven\repository\ch\qos\logback\logback-core\1.2.3\logback-core-1.2.3.jar;F:\workSpace\Maven\repository\org\slf4j\slf4j-api\1.7.30\slf4j-api-1.7.30.jar;F:\workSpace\Maven\repository\org\apache\logging\log4j\log4j-to-slf4j\2.12.1\log4j-to-slf4j-2.12.1.jar;F:\workSpace\Maven\repository\org\apache\logging\log4j\log4j-api\2.12.1\log4j-api-2.12.1.jar;F:\workSpace\Maven\repository\org\slf4j\jul-to-slf4j\1.7.30\jul-to-slf4j-1.7.30.jar;F:\workSpace\Maven\repository\jakarta\annotation\jakarta.annotation-api\1.3.5\jakarta.annotation-api-1.3.5.jar;F:\workSpace\Maven\repository\org\springframework\spring-core\5.2.5.RELEASE\spring-core-5.2.5.RELEASE.jar;F:\workSpace\Maven\repository\org\springframework\spring-jcl\5.2.5.RELEASE\spring-jcl-5.2.5.RELEASE.jar;F:\workSpace\Maven\repository\org\yaml\snakeyaml\1.25\snakeyaml-1.25.jar;F:\workSpace\Maven\repository\org\springframework\boot\spring-boot-starter-json\2.2.6.RELEASE\spring-boot-starter-json-2.2.6.RELEASE.jar;F:\workSpace\Maven\repository\com\fasterxml\jackson\core\jackson-databind\2.10.3\jackson-databind-2.10.3.jar;F:\workSpace\Maven\repository\com\fasterxml\jackson\core\jackson-annotations\2.10.3\jackson-annotations-2.10.3.jar;F:\workSpace\Maven\repository\com\fasterxml\jackson\core\jackson-core\2.10.3\jackson-core-2.10.3.jar;F:\workSpace\Maven\repository\com\fasterxml\jackson\datatype\jackson-datatype-jdk8\2.10.3\jackson-datatype-jdk8-2.10.3.jar;F:\workSpace\Maven\repository\com\fasterxml\jackson\datatype\jackson-datatype-jsr310\2.10.3\jackson-datatype-jsr310-2.10.3.jar;F:\workSpace\Maven\repository\com\fasterxml\jackson\module\jackson-module-parameter-names\2.10.3\jackson-module-parameter-names-2.10.3.jar;F:\workSpace\Maven\repository\org\springframework\boot\spring-boot-starter-tomcat\2.2.6.RELEASE\spring-boot-starter-tomcat-2.2.6.RELEASE.jar;F:\workSpace\Maven\repository\org\apache\tomcat\embed\tomcat-embed-core\9.0.33\tomcat-embed-core-9.0.33.jar;F:\workSpace\Maven\repository\org\apache\tomcat\embed\tomcat-embed-el\9.0.33\tomcat-embed-el-9.0.33.jar;F:\workSpace\Maven\repository\org\apache\tomcat\embed\tomcat-embed-websocket\9.0.33\tomcat-embed-websocket-9.0.33.jar;F:\workSpace\Maven\repository\org\springframework\boot\spring-boot-starter-validation\2.2.6.RELEASE\spring-boot-starter-validation-2.2.6.RELEASE.jar;F:\workSpace\Maven\repository\jakarta\validation\jakarta.validation-api\2.0.2\jakarta.validation-api-2.0.2.jar;F:\workSpace\Maven\repository\org\hibernate\validator\hibernate-validator\6.0.18.Final\hibernate-validator-6.0.18.Final.jar;F:\workSpace\Maven\repository\org\jboss\logging\jboss-logging\3.4.1.Final\jboss-logging-3.4.1.Final.jar;F:\workSpace\Maven\repository\com\fasterxml\classmate\1.5.1\classmate-1.5.1.jar;F:\workSpace\Maven\repository\org\springframework\spring-web\5.2.5.RELEASE\spring-web-5.2.5.RELEASE.jar;F:\workSpace\Maven\repository\org\springframework\spring-beans\5.2.5.RELEASE\spring-beans-5.2.5.RELEASE.jar;F:\workSpace\Maven\repository\org\springframework\spring-webmvc\5.2.5.RELEASE\spring-webmvc-5.2.5.RELEASE.jar;F:\workSpace\Maven\repository\org\springframework\spring-aop\5.2.5.RELEASE\spring-aop-5.2.5.RELEASE.jar;F:\workSpace\Maven\repository\org\springframework\spring-context\5.2.5.RELEASE\spring-context-5.2.5.RELEASE.jar;F:\workSpace\Maven\repository\org\springframework\spring-expression\5.2.5.RELEASE\spring-expression-5.2.5.RELEASE.jar;F:\workSpace\Maven\repository\org\apache\poi\poi-ooxml\3.10-FINAL\poi-ooxml-3.10-FINAL.jar;F:\workSpace\Maven\repository\org\apache\poi\poi\3.10-FINAL\poi-3.10-FINAL.jar;F:\workSpace\Maven\repository\commons-codec\commons-codec\1.13\commons-codec-1.13.jar;F:\workSpace\Maven\repository\dom4j\dom4j\1.6.1\dom4j-1.6.1.jar;F:\workSpace\Maven\repository\xml-apis\xml-apis\1.0.b2\xml-apis-1.0.b2.jar;F:\workSpace\Maven\repository\org\apache\poi\poi-ooxml-schemas\3.10-FINAL\poi-ooxml-schemas-3.10-FINAL.jar;F:\workSpace\Maven\repository\org\apache\xmlbeans\xmlbeans\2.3.0\xmlbeans-2.3.0.jar;F:\workSpace\Maven\repository\stax\stax-api\1.0.1\stax-api-1.0.1.jar;F:\workSpace\Maven\repository\com\alibaba\fastjson\1.2.53\fastjson-1.2.53.jar;F:\workSpace\Maven\repository\com\rabbitmq\amqp-client\3.4.1\amqp-client-3.4.1.jar;F:\workSpace\Maven\repository\org\json\json\20140107\json-20140107.jar;F:\workSpace\Maven\repository\junit\junit\4.12\junit-4.12.jar;F:\workSpace\Maven\repository\org\hamcrest\hamcrest-core\2.1\hamcrest-core-2.1.jar;F:\workSpace\Maven\repository\org\hamcrest\hamcrest\2.1\hamcrest-2.1.jar;F:\workSpace\Maven\repository\io\netty\netty-all\4.1.20.Final\netty-all-4.1.20.Final.jar;F:\workSpace\Maven\repository\org\msgpack\msgpack\0.6.12\msgpack-0.6.12.jar;F:\workSpace\Maven\repository\com\googlecode\json-simple\json-simple\1.1.1\json-simple-1.1.1.jar;F:\workSpace\Maven\repository\org\javassist\javassist\3.18.1-GA\javassist-3.18.1-GA.jar;F:\JetBrains\IntelliJ IDEA 2019.2.1\lib\idea_rt.jar
java.vm.specification.version = 1.8
sun.arch.data.model = 64
sun.java.command = com.example.offer.leecode.t20201015.CanJump
java.home = C:\Program Files\Java\Java1.8.1\jre
user.language = zh
java.specification.vendor = Oracle Corporation
awt.toolkit = sun.awt.windows.WToolkit
java.vm.info = mixed mode
java.version = 1.8.0_102
java.ext.dirs = C:\Program Files\Java\Java1.8.1\jre\lib\ext;C:\Windows\Sun\Java\lib\ext
sun.boot.class.path = C:\Program Files\Java\Java1.8.1\jre\lib\resources.jar;C:\Program Files\Java\Java1.8.1\jre\lib\rt.jar;C:\Program Files\Java\Java1.8.1\jre\lib\sunrsasign.jar;C:\Program Files\Java\Java1.8.1\jre\lib\jsse.jar;C:\Program Files\Java\Java1.8.1\jre\lib\jce.jar;C:\Program Files\Java\Java1.8.1\jre\lib\charsets.jar;C:\Program Files\Java\Java1.8.1\jre\lib\jfr.jar;C:\Program Files\Java\Java1.8.1\jre\classes
java.vendor = Oracle Corporation
file.separator = \
java.vendor.url.bug = http://bugreport.sun.com/bugreport/
sun.io.unicode.encoding = UnicodeLittle
sun.cpu.endian = little
sun.desktop = windows
sun.cpu.isalist = amd64

VM Flags:
Non-default VM flags: -XX:CICompilerCount=4 -XX:InitialHeapSize=268435456 -XX:MaxHeapSize=4273995776 -XX:MaxNewSize=1424490496 -XX:MinHeapDeltaBytes=524288 -XX:NewSize=89128960 -XX:OldSize=179306496 -XX:+UseCompressedClassPointers -XX:+UseCompressedOops -XX:+UseFastUnorderedTimeStamps -XX:-UseLargePagesIndividualAllocation -XX:+UseParallelGC
Command line:  -javaagent:F:\JetBrains\IntelliJ IDEA 2019.2.1\lib\idea_rt.jar=55312:F:\JetBrains\IntelliJ IDEA 2019.2.1\bin -Dfile.encoding=UTF-8


C:\Users\zero>

jinfo -flag name pid

查看指定 JVM 参数的值

C:\Users\zero>jinfo -flag InitialHeapSize 6880
-XX:InitialHeapSize=268435456

jinfo -flag [+|-]name pid

动静批改 JVM 参数的值

C:\Users\zero>jinfo -flag +PrintGC 8932

C:\Users\zero>jinfo -flag PrintGC 8932
-XX:+PrintGC

C:\Users\zero>jinfo -flag -PrintGC 8932

C:\Users\zero>jinfo -flag PrintGC 8932
-XX:-PrintGC

C:\Users\zero>

jmap:JAVA 内存映像工具

jmap 用于生成堆转储快照(heapdump 或 dump 文件)

生成 dump 文件的办法,设置虚拟机参数,让虚拟机在 OOM 异样后主动生成 dump 文件,或者 kill -3 dip,或者应用 jmap 获取,然而应用 jmap 命令会造成服务器停用,影响可能会很重大

# 呈现 OOME 时生成堆 dump: 
-XX:+HeapDumpOnOutOfMemoryError
#生成堆文件地址:-XX:HeapDumpPath=/home/liuke/jvmlogs/

罕用选项

选项 作用
-dump 生成 JAVA 堆转储快照
-heap 显示 JAVA 堆详细信息

应用 jmap 生成 dump 文件

C:\Users\zero>jmap -dump:format=b,file=work 5892
Dumping heap to C:\Users\zero\work ...
Heap dump file created

危险操作

最次要的危险操作是上面这三种:

  1. jmap -dump

这个命令执行,JVM 会将整个 heap 的信息 dump 写入到一个文件,heap 如果比拟大的话,就会导致这个过程比拟耗时,并且执行的过程中为了保障 dump 的信息是牢靠的,所以会暂停利用。

  1. jmap -permstat
    这个命令执行,JVM 会去统计 perm 区的情况,这整个过程也会比拟的耗时,并且同样也会暂停利用。
  2. jmap -histo:live
    这个命令执行,JVM 会先触发 gc,而后再统计信息。

jstack:JAVA 堆栈跟踪工具

jstack 命令用于生成虚拟机以后时刻的线程快照(threaddump 或者 javacore 文件)

罕用选项

选项 作用
-l 除堆栈外,显示无关锁的附加信息
-m 调用本地办法的话,能够显示 C /C++ 的堆栈

应用 jstack 查看线程堆栈

C:\Users\zero>jstack 14024
2020-10-21 22:06:55
Full thread dump Java HotSpot(TM) 64-Bit Server VM (25.102-b14 mixed mode):

"Service Thread" #11 daemon prio=9 os_prio=0 tid=0x000000001f982800 nid=0x3c2c runnable [0x0000000000000000]
   java.lang.Thread.State: RUNNABLE

"C1 CompilerThread3" #10 daemon prio=9 os_prio=2 tid=0x000000001f0e9800 nid=0x604 waiting on condition [0x0000000000000000]
   java.lang.Thread.State: RUNNABLE

"C2 CompilerThread2" #9 daemon prio=9 os_prio=2 tid=0x000000001f0e4800 nid=0x3b24 waiting on condition [0x0000000000000000]
   java.lang.Thread.State: RUNNABLE

"C2 CompilerThread1" #8 daemon prio=9 os_prio=2 tid=0x000000001f0e4000 nid=0x32fc waiting on condition [0x0000000000000000]
   java.lang.Thread.State: RUNNABLE

"C2 CompilerThread0" #7 daemon prio=9 os_prio=2 tid=0x000000001f0dd000 nid=0x428 waiting on condition [0x0000000000000000]
   java.lang.Thread.State: RUNNABLE

"Monitor Ctrl-Break" #6 daemon prio=5 os_prio=0 tid=0x000000001f081000 nid=0x2c08 runnable [0x000000001f55e000]
   java.lang.Thread.State: RUNNABLE
        at java.net.SocketInputStream.socketRead0(Native Method)
        at java.net.SocketInputStream.socketRead(SocketInputStream.java:116)
        at java.net.SocketInputStream.read(SocketInputStream.java:170)
        at java.net.SocketInputStream.read(SocketInputStream.java:141)
        at sun.nio.cs.StreamDecoder.readBytes(StreamDecoder.java:284)
        at sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:326)
        at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:178)
        - locked <0x000000076b44f888> (a java.io.InputStreamReader)
        at java.io.InputStreamReader.read(InputStreamReader.java:184)
        at java.io.BufferedReader.fill(BufferedReader.java:161)
        at java.io.BufferedReader.readLine(BufferedReader.java:324)
        - locked <0x000000076b44f888> (a java.io.InputStreamReader)
        at java.io.BufferedReader.readLine(BufferedReader.java:389)
        at com.intellij.rt.execution.application.AppMainV2$1.run(AppMainV2.java:64)

"Attach Listener" #5 daemon prio=5 os_prio=2 tid=0x000000001edf1800 nid=0x10c4 waiting on condition [0x0000000000000000]
   java.lang.Thread.State: RUNNABLE

"Signal Dispatcher" #4 daemon prio=9 os_prio=2 tid=0x000000001ed9d000 nid=0x1d14 runnable [0x0000000000000000]
   java.lang.Thread.State: RUNNABLE

"Finalizer" #3 daemon prio=8 os_prio=1 tid=0x000000001ed80800 nid=0x3c38 in Object.wait() [0x000000001f25f000]
   java.lang.Thread.State: WAITING (on object monitor)
        at java.lang.Object.wait(Native Method)
        - waiting on <0x000000076b188e98> (a java.lang.ref.ReferenceQueue$Lock)
        at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:143)
        - locked <0x000000076b188e98> (a java.lang.ref.ReferenceQueue$Lock)
        at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:164)
        at java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:209)

"Reference Handler" #2 daemon prio=10 os_prio=2 tid=0x000000000340c000 nid=0x3500 in Object.wait() [0x000000001ed5f000]
   java.lang.Thread.State: WAITING (on object monitor)
        at java.lang.Object.wait(Native Method)
        - waiting on <0x000000076b186b40> (a java.lang.ref.Reference$Lock)
        at java.lang.Object.wait(Object.java:502)
        at java.lang.ref.Reference.tryHandlePending(Reference.java:191)
        - locked <0x000000076b186b40> (a java.lang.ref.Reference$Lock)
        at java.lang.ref.Reference$ReferenceHandler.run(Reference.java:153)

"main" #1 prio=5 os_prio=0 tid=0x0000000003314800 nid=0x3fa8 waiting on condition [0x000000000309f000]
   java.lang.Thread.State: TIMED_WAITING (sleeping)
        at java.lang.Thread.sleep(Native Method)
        at com.example.offer.leecode.t20201015.CanJump.main(CanJump.java:57)

"VM Thread" os_prio=2 tid=0x000000001ce69800 nid=0x1f18 runnable

"GC task thread#0 (ParallelGC)" os_prio=0 tid=0x000000000332a800 nid=0x2b64 runnable

"GC task thread#1 (ParallelGC)" os_prio=0 tid=0x000000000332c000 nid=0x514 runnable

"GC task thread#2 (ParallelGC)" os_prio=0 tid=0x000000000332e000 nid=0x19f8 runnable

"GC task thread#3 (ParallelGC)" os_prio=0 tid=0x0000000003330800 nid=0x2608 runnable

"GC task thread#4 (ParallelGC)" os_prio=0 tid=0x0000000003332800 nid=0x2c84 runnable

"GC task thread#5 (ParallelGC)" os_prio=0 tid=0x0000000003333800 nid=0x406c runnable

"GC task thread#6 (ParallelGC)" os_prio=0 tid=0x0000000003337000 nid=0x2c38 runnable

"GC task thread#7 (ParallelGC)" os_prio=0 tid=0x0000000003338000 nid=0x2c54 runnable

"VM Periodic Task Thread" os_prio=2 tid=0x000000001fa2c000 nid=0x21d4 waiting on condition

JNI global references: 33


C:\Users\zero>jstack -l 14024
2020-10-21 22:07:00
Full thread dump Java HotSpot(TM) 64-Bit Server VM (25.102-b14 mixed mode):

"Service Thread" #11 daemon prio=9 os_prio=0 tid=0x000000001f982800 nid=0x3c2c runnable [0x0000000000000000]
   java.lang.Thread.State: RUNNABLE

   Locked ownable synchronizers:
        - None

"C1 CompilerThread3" #10 daemon prio=9 os_prio=2 tid=0x000000001f0e9800 nid=0x604 waiting on condition [0x0000000000000000]
   java.lang.Thread.State: RUNNABLE

   Locked ownable synchronizers:
        - None

"C2 CompilerThread2" #9 daemon prio=9 os_prio=2 tid=0x000000001f0e4800 nid=0x3b24 waiting on condition [0x0000000000000000]
   java.lang.Thread.State: RUNNABLE

   Locked ownable synchronizers:
        - None

"C2 CompilerThread1" #8 daemon prio=9 os_prio=2 tid=0x000000001f0e4000 nid=0x32fc waiting on condition [0x0000000000000000]
   java.lang.Thread.State: RUNNABLE

   Locked ownable synchronizers:
        - None

"C2 CompilerThread0" #7 daemon prio=9 os_prio=2 tid=0x000000001f0dd000 nid=0x428 waiting on condition [0x0000000000000000]
   java.lang.Thread.State: RUNNABLE

   Locked ownable synchronizers:
        - None

"Monitor Ctrl-Break" #6 daemon prio=5 os_prio=0 tid=0x000000001f081000 nid=0x2c08 runnable [0x000000001f55e000]
   java.lang.Thread.State: RUNNABLE
        at java.net.SocketInputStream.socketRead0(Native Method)
        at java.net.SocketInputStream.socketRead(SocketInputStream.java:116)
        at java.net.SocketInputStream.read(SocketInputStream.java:170)
        at java.net.SocketInputStream.read(SocketInputStream.java:141)
        at sun.nio.cs.StreamDecoder.readBytes(StreamDecoder.java:284)
        at sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:326)
        at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:178)
        - locked <0x000000076b44f888> (a java.io.InputStreamReader)
        at java.io.InputStreamReader.read(InputStreamReader.java:184)
        at java.io.BufferedReader.fill(BufferedReader.java:161)
        at java.io.BufferedReader.readLine(BufferedReader.java:324)
        - locked <0x000000076b44f888> (a java.io.InputStreamReader)
        at java.io.BufferedReader.readLine(BufferedReader.java:389)
        at com.intellij.rt.execution.application.AppMainV2$1.run(AppMainV2.java:64)

   Locked ownable synchronizers:
        - None

"Attach Listener" #5 daemon prio=5 os_prio=2 tid=0x000000001edf1800 nid=0x10c4 waiting on condition [0x0000000000000000]
   java.lang.Thread.State: RUNNABLE

   Locked ownable synchronizers:
        - None

"Signal Dispatcher" #4 daemon prio=9 os_prio=2 tid=0x000000001ed9d000 nid=0x1d14 runnable [0x0000000000000000]
   java.lang.Thread.State: RUNNABLE

   Locked ownable synchronizers:
        - None

"Finalizer" #3 daemon prio=8 os_prio=1 tid=0x000000001ed80800 nid=0x3c38 in Object.wait() [0x000000001f25f000]
   java.lang.Thread.State: WAITING (on object monitor)
        at java.lang.Object.wait(Native Method)
        - waiting on <0x000000076b188e98> (a java.lang.ref.ReferenceQueue$Lock)
        at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:143)
        - locked <0x000000076b188e98> (a java.lang.ref.ReferenceQueue$Lock)
        at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:164)
        at java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:209)

   Locked ownable synchronizers:
        - None

"Reference Handler" #2 daemon prio=10 os_prio=2 tid=0x000000000340c000 nid=0x3500 in Object.wait() [0x000000001ed5f000]
   java.lang.Thread.State: WAITING (on object monitor)
        at java.lang.Object.wait(Native Method)
        - waiting on <0x000000076b186b40> (a java.lang.ref.Reference$Lock)
        at java.lang.Object.wait(Object.java:502)
        at java.lang.ref.Reference.tryHandlePending(Reference.java:191)
        - locked <0x000000076b186b40> (a java.lang.ref.Reference$Lock)
        at java.lang.ref.Reference$ReferenceHandler.run(Reference.java:153)

   Locked ownable synchronizers:
        - None

"main" #1 prio=5 os_prio=0 tid=0x0000000003314800 nid=0x3fa8 waiting on condition [0x000000000309f000]
   java.lang.Thread.State: TIMED_WAITING (sleeping)
        at java.lang.Thread.sleep(Native Method)
        at com.example.offer.leecode.t20201015.CanJump.main(CanJump.java:57)

   Locked ownable synchronizers:
        - None

"VM Thread" os_prio=2 tid=0x000000001ce69800 nid=0x1f18 runnable

"GC task thread#0 (ParallelGC)" os_prio=0 tid=0x000000000332a800 nid=0x2b64 runnable

"GC task thread#1 (ParallelGC)" os_prio=0 tid=0x000000000332c000 nid=0x514 runnable

"GC task thread#2 (ParallelGC)" os_prio=0 tid=0x000000000332e000 nid=0x19f8 runnable

"GC task thread#3 (ParallelGC)" os_prio=0 tid=0x0000000003330800 nid=0x2608 runnable

"GC task thread#4 (ParallelGC)" os_prio=0 tid=0x0000000003332800 nid=0x2c84 runnable

"GC task thread#5 (ParallelGC)" os_prio=0 tid=0x0000000003333800 nid=0x406c runnable

"GC task thread#6 (ParallelGC)" os_prio=0 tid=0x0000000003337000 nid=0x2c38 runnable

"GC task thread#7 (ParallelGC)" os_prio=0 tid=0x0000000003338000 nid=0x2c54 runnable

"VM Periodic Task Thread" os_prio=2 tid=0x000000001fa2c000 nid=0x21d4 waiting on condition

JNI global references: 33


C:\Users\zero>jstack -m 14024
Attaching to process ID 14024, please wait...
Debugger attached successfully.
Server compiler detected.
JVM version is 25.102-b14
Deadlock Detection:

No deadlocks found.

----------------- 0 -----------------
0x00007ffb6fa55154      ntdll!ZwWaitForSingleObject + 0x14
0xec8b485741564155              ????????
sun.jvm.hotspot.debugger.DebuggerException: Windbg Error: ReadVirtual failed!
        at sun.jvm.hotspot.debugger.windbg.WindbgDebuggerLocal.readBytesFromProcess0(Native Method)
        at sun.jvm.hotspot.debugger.windbg.WindbgDebuggerLocal.readBytesFromProcess(WindbgDebuggerLocal.java:490)
        at sun.jvm.hotspot.debugger.DebuggerBase$Fetcher.fetchPage(DebuggerBase.java:80)
        at sun.jvm.hotspot.debugger.PageCache.getPage(PageCache.java:178)
        at sun.jvm.hotspot.debugger.PageCache.getLong(PageCache.java:100)
        at sun.jvm.hotspot.debugger.DebuggerBase.readCInteger(DebuggerBase.java:364)
        at sun.jvm.hotspot.debugger.DebuggerBase.readAddressValue(DebuggerBase.java:462)
        at sun.jvm.hotspot.debugger.windbg.WindbgDebuggerLocal.readAddress(WindbgDebuggerLocal.java:316)
        at sun.jvm.hotspot.debugger.windbg.WindbgAddress.getAddressAt(WindbgAddress.java:72)
        at sun.jvm.hotspot.debugger.windows.amd64.WindowsAMD64CFrame.sender(WindowsAMD64CFrame.java:60)
        at sun.jvm.hotspot.tools.PStack.run(PStack.java:161)
        at sun.jvm.hotspot.tools.PStack.run(PStack.java:58)
        at sun.jvm.hotspot.tools.PStack.run(PStack.java:53)
        at sun.jvm.hotspot.tools.JStack.run(JStack.java:66)
        at sun.jvm.hotspot.tools.Tool.startInternal(Tool.java:260)
        at sun.jvm.hotspot.tools.Tool.start(Tool.java:223)
        at sun.jvm.hotspot.tools.Tool.execute(Tool.java:118)
        at sun.jvm.hotspot.tools.JStack.main(JStack.java:92)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at sun.tools.jstack.JStack.runJStackTool(JStack.java:140)
        at sun.tools.jstack.JStack.main(JStack.java:106)
----------------- 1 -----------------
----------------- 2 -----------------
----------------- 3 -----------------
0x00007ffb6fa55c24      ntdll!NtWaitForMultipleObjects + 0x14
----------------- 4 -----------------
----------------- 5 -----------------
----------------- 6 -----------------
----------------- 7 -----------------
----------------- 8 -----------------
----------------- 9 -----------------
----------------- 10 -----------------
----------------- 11 -----------------
----------------- 12 -----------------
0x00007ffb6fa55154      ntdll!ZwWaitForSingleObject + 0x14
----------------- 13 -----------------
0x00007ffb6fa55154      ntdll!ZwWaitForSingleObject + 0x14
----------------- 14 -----------------
0x00007ffb6fa55154      ntdll!ZwWaitForSingleObject + 0x14
----------------- 15 -----------------
0x00007ffb6fa55154      ntdll!ZwWaitForSingleObject + 0x14
----------------- 16 -----------------
0x00007ffb6fa55154      ntdll!ZwWaitForSingleObject + 0x14
----------------- 17 -----------------
0x00007ffb6fa55154      ntdll!ZwWaitForSingleObject + 0x14
----------------- 18 -----------------
0x00007ffb6fa55154      ntdll!ZwWaitForSingleObject + 0x14
----------------- 19 -----------------
0x00007ffb6fa55154      ntdll!ZwWaitForSingleObject + 0x14
----------------- 20 -----------------
0x00007ffb6fa55154      ntdll!ZwWaitForSingleObject + 0x14
----------------- 21 -----------------
0x00007ffb6fa55154      ntdll!ZwWaitForSingleObject + 0x14
----------------- 22 -----------------
----------------- 23 -----------------
0x00007ffb6fa55154      ntdll!ZwWaitForSingleObject + 0x14
退出移动版