Virtual machine performance monitoring and fault handling commands on the console

Posted by PoOP on Sun, 12 Dec 2021 03:51:12 +0100

Virtual machine performance monitoring and fault handling tools on the command line

Front

Track and sort out some contents of Chapter 4 in the in-depth understanding of JAVA virtual machine

  1. Normal JAVA environment
  2. Randomly find a JAVA program
  3. JDK version: jdk1.0 8.0_ seventy-three

jps: virtual machine process status tool

JVM Process State You can find the running virtual machine process number, display the main class name and the unique id of the local virtual machine, and the command format jps [option] [hostid]

option

effect

Null parameter = common

Output main class name and LVMID

-q

Output LVMID only

-m

Output the parameters passed to the main class when the virtual machine starts

-l) common

When we start the JAR package, the JAR path will be output; Further confirm the process id you want to confirm

-v

Output JVM parameters at startup

jstat: virtual machine statistics monitoring tool

JVM Statistics Monitoring Tool Monitor various running status information of virtual machine; Display class loading, memory, garbage collection, real-time compilation, etc. in the process; If there is no server with GUI Graphical interface, you can view the health status through this command. The command format is: jstat [option vmid [interval[s|ms] [count]] ] Example: jstat -gc 12252 500 10 ⇒ print gc information of process 12252 once every 500ms, print 10 times

There is a special blog for jstat: Use the jstat command to view the GC of the jvm (take Linux as an example)

class

jstat -class 12252

Loaded

Bytes

Unloaded

Bytes

Time

6003

10740.9

0

0.0

1.55

  1. Loaded: loaded class
  2. Bytes: space occupied by loaded class locks
  3. Unloaded: unloaded quantity
  4. Bytes: occupied space not loaded
  5. Time: time

gc

GC needs to have a certain understanding of heap distribution; it can be simply divided into Eden area of the young generation, from + to area, old age and permanent generation jstat -gc 12252

S0C

S1C

S0U

S1U

EC

EU

OC

OU

MC

MU

CCSC

CCSU

YGC

YGCT

FGC

FGCT

GCT

9728.0

5120.0

0.0

5098.8

66560.0

64001.7

58880.0

10236.9

28032.0

26079.1

3968.0

3521.6

5

0.022

1

0.020

0.042

  1. S represents: Survivor, S0/S1 represents from and to of the surviving area;
  2. E for Eden District
  3. O stands for: old age
  4. M stands for meta space Note: in the chapter of automatic memory management, it is mentioned that the wrong generation before JDK1.7 is equivalent to the permanent generation; after JDK1.8, the permanent generation is completely abandoned and all are moved to the meta space; if there is any error, please forgive me
  5. CC stands for Compressed Class space. For reference: How to understand compressed class space and how important it is in JVM tuning?
  6. YGC: Young GC, which occurs in the Cenozoic GC
  7. FGC: Full GC, which collects the whole heap, including the patterns of young gen, old gen and perm Gen (meta space)

Suffix U:use, C:count, T:time

gccapacity

jstat -gccapacity 12252 Specific spaces can be specified here, such as young generation gcnewcapacity / old age gcoldcapacity / meta space gcpermcapacity

NGCMN

NGCMX

NGC

S0C

S1C

EC

OGCMN

OGCMX OGC

OC

MCMN

MCMX

MC

CCSMN

CCSMX

CCSC

YGC

FGC

43520.0

692224.0

158208.0

9216.0

9216.0

102400.0

87552.0

1384448.0

58880.0

58880.0

0.0

1077248.0

31616.0

0.0

1048576.0

4480.0

7

  1. NGC: younger generation / MN: min / MX: Max
  2. S0/S1/EC/YGC/FGC: refer to the description in gc option
  3. OGC: old age / MN: min / MX: Max
  4. O: Current old age capacity
  5. MC: meta space / MN: min / MX: Max
  6. CC: refer to the description in the gc option

gcutil

Count the gc status of each region. Refer to the description in the gc option for instructions

jstat -gcutil 12252

S0

S1

E

O

M

CCS

YGC

YGCT

FGC

FGCT

GCT

91.11

0.00

3.82

17.43

91.74

88.10

8

0.042

1

0.020

0.062

gccause

Show the reason for the last recycling failure: possible wrong References: Reading notes on jvm source code 7 - talking about GC cause s in the jvm from the jstat -gccause command jstat -gccause 12252

S0

S1

E

O

M

CCS

YGC

YGCT

FGC

FGCT

GCT

LGCC

GCC

91.11

0.00

8.89

17.43

91.74

88.10

8

0.042

1

0.020

0.062

Allocation Failure

No GC

compiler

jstat -compiler 12252 Statistics on the methods and time-consuming of real-time compilation, no abbreviation and strong readability

Compiled

Failed

Invalid

Time

FailedType

FailedMethod

3208

0

0

0.64

0

printcompilation

jstat -printcompilation 12252 Output methods that have been compiled

Compiled

Size

Type

Method

3208

10

1

java/util/Collections$UnmodifiableMap$UnmodifiableEntrySet$1 hasNext

  1. Size indicates the number of bytecodes of the most recently compiled method
  2. Type represents the type of the method that has also been compiled recently

jinfo: Java configuration information tool

Configuration Info for Java is integrated into JHSDB in JDK 9 View and adjust the parameters of the virtual machine in real time; jps -v can only view the explicitly specified; if it is not explicitly specified, it needs to be found through this instruction. The command format is: jinfo [option] pid Let's look at the following tips:

D:\doc>jinfo
Usage:
    jinfo [option] <pid>
        (to connect to running process)
    jinfo [option] <executable <core>
        (to connect to a core file)
    jinfo [option] [server_id@]<remote server IP or hostname>
        (to connect to remote debug server)
where <option> is one of:
    -flag <name>         to print the value of the named VM flag
    -flag [+|-]<name>    to enable or disable the named VM flag
    -flag <name>=<value> to set the named VM flag to the given value
    -flags               to print VM flags
    -sysprops            to print Java system properties
    <no option>          to print both of the above
    -h | -help           to print this help message

See all the configuration information below:

jinfo -flags 12252
Attaching to process ID 12252, please wait...
Debugger attached successfully.
Server compiler detected.
JVM version is 25.73-b02
Non-default VM flags: -XX:-BytecodeVerificationLocal -XX:-BytecodeVerificationRemote -XX:CICompilerCount=4 -XX:InitialHeapSize=134217728 -XX:+ManagementServer -XX:MaxHeapSize=2126512128 -XX:MaxNewSize=708837376 -XX:Min
HeapDeltaBytes=524288 -XX:NewSize=44564480 -XX:OldSize=89653248 -XX:TieredStopAtLevel=1 -XX:+UseCompressedClassPointers -XX:+UseCompressedOops -XX:+UseFastUnorderedTimeStamps -XX:-UseLargePagesIndividualAllocation -XX:
+UseParallelGC
Command line:  -XX:TieredStopAtLevel=1 -Xverify:none -Dspring.output.ansi.enabled=always -javaagent:D:\framework\idea\IntelliJ IDEA 2021.2\lib\idea_rt.jar=53149:D:\framework\idea\IntelliJ IDEA 2021.2\bin -Dcom.sun.mana
gement.jmxremote -Dspring.jmx.enabled=true -Dspring.liveBeansView.mbeanDomain -Dspring.application.admin.enabled=true -Dfile.encoding=UTF-8

You can also query a single, such as:

D:\doc>jinfo -flag NewSize 12252
-XX:NewSize=44564480

jmap: memory mapping tool

Memory Map for Java It is used to generate stack storage snapshot, query finalize execution queue and details of Java heap method area (such as space utilization and currently used collector). The command format is: jmap [option] vmid

dump

Generally, the production environment will not release this command randomly, and there will be STW problems when generating snapshots. The online environment must not engage in this kind of thing during the peak period (I have encountered an online failure caused by the O & M peak period because I wanted to tangle with a bug)

Example: jmap -dump:live,format=b,file=D:\heap.hprof 12252 There are many ways to generate dump files, such as

  1. jmap -dump command
  2. -20: + heapdumponctrlbreak: you can use Ctrl+Break to generate snapshot files
  3. -20: + heapdumponoutofmemoryerror: memory overflow automatically generates stack snapshot file
  4. Linux system intimidates virtual machine through Kill -3
  5. In the visual interface of jConsole, you can also generate dump files through jmx

dump files can be analyzed using tools such as jhat/jprofile

finalizerinfo

Objects that explicitly wait for Finalizer to execute the finalize method in the F-Queue

jmap -finalizerinfo 12252
Attaching to process ID 12252, please wait...
Debugger attached successfully.
Server compiler detected.
JVM version is 25.73-b02
Number of objects pending for finalization: 0

heap

View the details of the java heap, including classes, number of instances, and total capacity

jmap -heap 12252
Attaching to process ID 12252, please wait...
Debugger attached successfully.
Server compiler detected.
JVM version is 25.73-b02
using thread-local object allocation.
Parallel GC with 10 thread(s)
Heap Configuration:
   MinHeapFreeRatio         = 0
   MaxHeapFreeRatio         = 100
   MaxHeapSize              = 2126512128 (2028.0MB)
   NewSize                  = 44564480 (42.5MB)
   MaxNewSize               = 708837376 (676.0MB)
   OldSize                  = 89653248 (85.5MB)
   NewRatio                 = 2
   SurvivorRatio            = 8
   MetaspaceSize            = 21807104 (20.796875MB)
   CompressedClassSpaceSize = 1073741824 (1024.0MB)
   MaxMetaspaceSize         = 17592186044415 MB
   G1HeapRegionSize         = 0 (0.0MB)
   capacity = 10485760 (10.0MB)
Heap Usage:
PS Young Generation
Eden Space:
   capacity = 95420416 (91.0MB)
   used     = 37705416 (35.95868682861328MB)
   free     = 57715000 (55.04131317138672MB)
   39.51504047100361% used
From Space:
   capacity = 4194304 (4.0MB)
   used     = 0 (0.0MB)
   free     = 4194304 (4.0MB)
   0.0% used
To Space:
   capacity = 10485760 (10.0MB)
   used     = 0 (0.0MB)
   free     = 10485760 (10.0MB)
   0.0% used
PS Old Generation
   capacity = 92274688 (88.0MB)
   used     = 8235968 (7.85443115234375MB)
   free     = 84038720 (80.14556884765625MB)
   8.92548994584517% used
10869 interned Strings occupying 972216 bytes.

histo

This section is truncated because the statistics of all objects, including class / instance quantity / total capacity, will be printed. When we look at the dump file, it also has the same content

jmap -histo 12252
 num     #instances         #bytes  class name
----------------------------------------------
   1:        127133       11521344  [C
   2:         39218        7555416  [B
   3:        128165        4763152  [Ljava.lang.Object;
   4:         24278        3558352  [I
   5:         68132        2180224  java.io.ObjectStreamClass$WeakClassKey
   6:         79936        1918464  java.lang.String
   7:         11253        1170312  java.io.ObjectStreamClass

permstat

Taking ClassLoader as the statistical root, the memory state of the explicit permanent generation can only be used in Linux/Solaris; windows does not support it at all

jhat: virtual machine stack storage snapshot analysis tool

The dump file is generated in jmap; it is analyzed here and replaced by JHSDB in JDK 9

jhat D:\heap.hprof
Reading from D:\heap.hprof...
Dump file created Sat Dec 11 23:18:25 CST 2021
Snapshot read, resolving...
Resolving 166946 objects...
Chasing references, expect 33 dots.................................
Eliminating duplicate references.................................
Snapshot resolved.
Started HTTP server on port 7000
Server is ready.

Then visit localhost:7000 locally However, the interface operation is not friendly enough; the same types include: VisualVM, Eclipse Memory Analyzer, IBM heapananalyzer, and I choose jprofile analysis

jstack: Java stack trace tool

Stack Trace for Java is integrated into JHSDB in JDK 9 Generate a thread snapshot at the current time of the virtual machine. The thread snapshot is the collection of method stacks being executed by each thread in the current virtual machine. The main purpose is to locate the cause of thread pause for a long time, whether there is deadlock / loop / external resources leading to long-time suspension, etc.; command format: jstack [option] vmid Since Thread provides getAllStackTraces() after JDK 1.5, you can write a tool method to implement the function of this gadget, but you'd better test it Change a section of code that will deadlock for tracking:

public class Main {
    static Object lock1 = new Object();
    static Object lock2 = new Object();


    public static void main(String[] args)  {
        new Thread(() -> methodA()).start();
        new Thread(() -> methodB()).start();
    }

    private static void methodA() {
        synchronized (lock1) {
            secondSleep(1);
            synchronized (lock2) {
                secondSleep(1);
                System.out.print("methodA");
            }
        }
    }
    private static void methodB()  {
        synchronized (lock2) {
            secondSleep(1);
            synchronized (lock1) {
                secondSleep(1);
                System.out.print("methodB");
            }
        }
    }


    public static void secondSleep(int second) {
        try {
            TimeUnit.SECONDS.sleep(second);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }
}

default

$ jstack 15996
2021-12-12 07:51:35
Full thread dump Java HotSpot(TM) 64-Bit Server VM (25.73-b02 mixed mode):

"DestroyJavaVM" #14 prio=5 os_prio=0 tid=0x000000001a186800 nid=0x3f88 waiting on condition [0x0000000000000000]
   java.lang.Thread.State: RUNNABLE

"Thread-1" #13 prio=5 os_prio=0 tid=0x000000001a182800 nid=0x4b94 waiting for monitor entry [0x000000001c76e000]
   java.lang.Thread.State: BLOCKED (on object monitor)
        at com.caicai.study.sa_token.Main.methodB(Main.java:29)
        - waiting to lock <0x00000000d5f51db8> (a java.lang.Object)
        - locked <0x00000000d5f51dc8> (a java.lang.Object)
        at com.caicai.study.sa_token.Main.lambda$main$1(Main.java:13)
        at com.caicai.study.sa_token.Main$$Lambda$2/769287236.run(Unknown Source)
        at java.lang.Thread.run(Thread.java:745)

"Thread-0" #12 prio=5 os_prio=0 tid=0x000000001a188800 nid=0xe08 waiting for monitor entry [0x000000001c66e000]
   java.lang.Thread.State: BLOCKED (on object monitor)
        at com.caicai.study.sa_token.Main.methodA(Main.java:20)
        - waiting to lock <0x00000000d5f51dc8> (a java.lang.Object)
        - locked <0x00000000d5f51db8> (a java.lang.Object)
        at com.caicai.study.sa_token.Main.lambda$main$0(Main.java:12)
        at com.caicai.study.sa_token.Main$$Lambda$1/1867750575.run(Unknown Source)
        at java.lang.Thread.run(Thread.java:745)

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

F

When a normally output request is not responded to, the stack is forced to be output

$ jstack -F 15996
Attaching to process ID 15996, please wait...
Debugger attached successfully.
Server compiler detected.
JVM version is 25.73-b02
Deadlock Detection:

Found one Java-level deadlock:
=============================

"Thread-0":
  waiting to lock Monitor@0x000000000385adb8 (Object@0x00000000d5f51dc8, a java/lang/Object),
  which is held by "Thread-1"
"Thread-1":
  waiting to lock Monitor@0x000000000385d648 (Object@0x00000000d5f51db8, a java/lang/Object),
  which is held by "Thread-0"

Found a total of 1 deadlock.

Thread 1: (state = BLOCKED)


Thread 25: (state = BLOCKED)
 - com.caicai.study.sa_token.Main.methodB() @bci=16, line=29 (Interpreted frame)
 - com.caicai.study.sa_token.Main.lambda$main$1() @bci=0, line=13 (Interpreted frame)
 - com.caicai.study.sa_token.Main$$Lambda$2.run() @bci=0 (Interpreted frame)
 - java.lang.Thread.run() @bci=11, line=745 (Interpreted frame)
 - ... Omit

l

In addition to the stack, additional information about the lock is displayed

$ jstack -l 15996
2021-12-12 08:00:20
Full thread dump Java HotSpot(TM) 64-Bit Server VM (25.73-b02 mixed mode):

"DestroyJavaVM" #14 prio=5 os_prio=0 tid=0x000000001a186800 nid=0x3f88 waiting on condition [0x0000000000000000]
   java.lang.Thread.State: RUNNABLE

   Locked ownable synchronizers:
        - None

"Thread-1" #13 prio=5 os_prio=0 tid=0x000000001a182800 nid=0x4b94 waiting for monitor entry [0x000000001c76e000]
   java.lang.Thread.State: BLOCKED (on object monitor)
        at com.caicai.study.sa_token.Main.methodB(Main.java:29)
        - waiting to lock <0x00000000d5f51db8> (a java.lang.Object)
        - locked <0x00000000d5f51dc8> (a java.lang.Object)
        at com.caicai.study.sa_token.Main.lambda$main$1(Main.java:13)
        at com.caicai.study.sa_token.Main$$Lambda$2/769287236.run(Unknown Source)
        at java.lang.Thread.run(Thread.java:745)

   Locked ownable synchronizers:
        - None

"Thread-0" #12 prio=5 os_prio=0 tid=0x000000001a188800 nid=0xe08 waiting for monitor entry [0x000000001c66e000]
   java.lang.Thread.State: BLOCKED (on object monitor)
        at com.caicai.study.sa_token.Main.methodA(Main.java:20)
        - waiting to lock <0x00000000d5f51dc8> (a java.lang.Object)
        - locked <0x00000000d5f51db8> (a java.lang.Object)
        at com.caicai.study.sa_token.Main.lambda$main$0(Main.java:12)
        at com.caicai.study.sa_token.Main$$Lambda$1/1867750575.run(Unknown Source)
        at java.lang.Thread.run(Thread.java:745)

   Locked ownable synchronizers:
        - None

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

   Locked ownable synchronizers:
        - None

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

   Locked ownable synchronizers:
        - None

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

   Locked ownable synchronizers:
        - None

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

   Locked ownable synchronizers:
        - None

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

   Locked ownable synchronizers:
        - None

"Monitor Ctrl-Break" #6 daemon prio=5 os_prio=0 tid=0x000000001a187000 nid=0x4620 runnable [0x000000001b76e000]
   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 <0x00000000d5ed9d28> (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 <0x00000000d5ed9d28> (a java.io.InputStreamReader)
        at java.io.BufferedReader.readLine(BufferedReader.java:389)
        at com.intellij.rt.execution.application.AppMainV2$1.run(AppMainV2.java:49)

   Locked ownable synchronizers:
        - None

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

   Locked ownable synchronizers:
        - None

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

   Locked ownable synchronizers:
        - None

"Finalizer" #3 daemon prio=8 os_prio=1 tid=0x000000000385d800 nid=0x487c in Object.wait() [0x000000001b46e000]
   java.lang.Thread.State: WAITING (on object monitor)
        at java.lang.Object.wait(Native Method)
        - waiting on <0x00000000d5c07110> (a java.lang.ref.ReferenceQueue$Lock)
        at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:143)
        - locked <0x00000000d5c07110> (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=0x0000000018a1c800 nid=0x46b4 in Object.wait() [0x000000001b36e000]
   java.lang.Thread.State: WAITING (on object monitor)
        at java.lang.Object.wait(Native Method)
        - waiting on <0x00000000d5c06b50> (a java.lang.ref.Reference$Lock)
        at java.lang.Object.wait(Object.java:502)
        at java.lang.ref.Reference$ReferenceHandler.run(Reference.java:157)
        - locked <0x00000000d5c06b50> (a java.lang.ref.Reference$Lock)

   Locked ownable synchronizers:
        - None

"VM Thread" os_prio=2 tid=0x0000000018a16800 nid=0x16b4 runnable

"GC task thread#0 (ParallelGC)" os_prio=0 tid=0x0000000003779800 nid=0x102c runnable

"GC task thread#1 (ParallelGC)" os_prio=0 tid=0x000000000377b000 nid=0x4fc runnable

"GC task thread#2 (ParallelGC)" os_prio=0 tid=0x000000000377c800 nid=0x377c runnable

"GC task thread#3 (ParallelGC)" os_prio=0 tid=0x000000000377f000 nid=0x359c runnable

"GC task thread#4 (ParallelGC)" os_prio=0 tid=0x0000000003781800 nid=0x451c runnable

"GC task thread#5 (ParallelGC)" os_prio=0 tid=0x0000000003782800 nid=0x4738 runnable

"GC task thread#6 (ParallelGC)" os_prio=0 tid=0x0000000003786000 nid=0x3a44 runnable

"GC task thread#7 (ParallelGC)" os_prio=0 tid=0x0000000003787000 nid=0x2a1c runnable

"GC task thread#8 (ParallelGC)" os_prio=0 tid=0x0000000003788000 nid=0x7ec runnable

"GC task thread#9 (ParallelGC)" os_prio=0 tid=0x0000000003789800 nid=0x4a40 runnable

"VM Periodic Task Thread" os_prio=2 tid=0x000000001a487000 nid=0x1154 waiting on condition

JNI global references: 319


Found one Java-level deadlock:
=============================
"Thread-1":
  waiting to lock monitor 0x000000000385d648 (object 0x00000000d5f51db8, a java.lang.Object),
  which is held by "Thread-0"
"Thread-0":
  waiting to lock monitor 0x000000000385adb8 (object 0x00000000d5f51dc8, a java.lang.Object),
  which is held by "Thread-1"

Java stack information for the threads listed above:
===================================================
"Thread-1":
        at com.caicai.study.sa_token.Main.methodB(Main.java:29)
        - waiting to lock <0x00000000d5f51db8> (a java.lang.Object)
        - locked <0x00000000d5f51dc8> (a java.lang.Object)
        at com.caicai.study.sa_token.Main.lambda$main$1(Main.java:13)
        at com.caicai.study.sa_token.Main$$Lambda$2/769287236.run(Unknown Source)
        at java.lang.Thread.run(Thread.java:745)
"Thread-0":
        at com.caicai.study.sa_token.Main.methodA(Main.java:20)
        - waiting to lock <0x00000000d5f51dc8> (a java.lang.Object)
        - locked <0x00000000d5f51db8> (a java.lang.Object)
        at com.caicai.study.sa_token.Main.lambda$main$0(Main.java:12)
        at com.caicai.study.sa_token.Main$$Lambda$1/1867750575.run(Unknown Source)
        at java.lang.Thread.run(Thread.java:745)

Found 1 deadlock.

m

If you call a local method, you can display the stack of C and C + +

$ jstack -m 15996
Attaching to process ID 15996, please wait...
Debugger attached successfully.
Server compiler detected.
JVM version is 25.73-b02
Deadlock Detection:

Found one Java-level deadlock:
=============================

"Thread-0":
  waiting to lock Monitor@0x000000000385adb8 (Object@0x00000000d5f51dc8, a java/lang/Object),
  which is held by "Thread-1"
"Thread-1":
  waiting to lock Monitor@0x000000000385d648 (Object@0x00000000d5f51db8, a java/lang/Object),
  which is held by "Thread-0"

Found a total of 1 deadlock.

----------------- 0 -----------------
0x00007ffb49b8cdf4      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:497)
        at sun.tools.jstack.JStack.runJStackTool(JStack.java:140)
        at sun.tools.jstack.JStack.main(JStack.java:106)
----------------- 1 -----------------
----------------- 2 -----------------
----------------- 3 -----------------
----------------- 4 -----------------
----------------- 5 -----------------
----------------- 6 -----------------
----------------- 7 -----------------
----------------- 8 -----------------
----------------- 9 -----------------
----------------- 10 -----------------
----------------- 11 -----------------
----------------- 12 -----------------
0x00007ffb49b8cdf4      ntdll!ZwWaitForSingleObject + 0x14
----------------- 13 -----------------
0x00007ffb49b8cdf4      ntdll!ZwWaitForSingleObject + 0x14
----------------- 14 -----------------
0x00007ffb49b8cdf4      ntdll!ZwWaitForSingleObject + 0x14
----------------- 15 -----------------
0x00007ffb49b8cdf4      ntdll!ZwWaitForSingleObject + 0x14
----------------- 16 -----------------
0x00007ffb49b8cdf4      ntdll!ZwWaitForSingleObject + 0x14
----------------- 17 -----------------
0x00007ffb49b8cdf4      ntdll!ZwWaitForSingleObject + 0x14
----------------- 18 -----------------
0x00007ffb49b8cdf4      ntdll!ZwWaitForSingleObject + 0x14
----------------- 19 -----------------
0x00007ffb49b8cdf4      ntdll!ZwWaitForSingleObject + 0x14
----------------- 20 -----------------
0x00007ffb49b8cdf4      ntdll!ZwWaitForSingleObject + 0x14
----------------- 21 -----------------
0x00007ffb49b8cdf4      ntdll!ZwWaitForSingleObject + 0x14
----------------- 22 -----------------
----------------- 23 -----------------
0x00007ffb49b8cdf4      ntdll!ZwWaitForSingleObject + 0x14
----------------- 24 -----------------
0x00007ffb49b8cdf4      ntdll!ZwWaitForSingleObject + 0x14
----------------- 25 -----------------
0x00007ffb49b8cdf4      ntdll!ZwWaitForSingleObject + 0x14