Thread running diagnosis uses jstack to find out whether the thread is infinite loop and thread deadlock

Use top to locate that process whose cpu occupancy is too high, and find the pid that occupies too high

top

Insert picture description here

When using the ps command to further locate which thread caused the cpu usage to be too high

ps H -eo  pid,tid,%cpu | grep 进程id

Insert picture description here

jstack process id

jstack 32655

The problematic thread can be found according to the thread id, and the source line number of the problem code can be further located.
Use a calculator to convert the thread number 32665 to hexadecimal. The result is 7F99
Insert picture description here
. Find the value of nid in the reported exception and you can find the location of the corresponding code error.
Insert picture description here
Our online code may also be deadlocked. The same page can use jstack process id to diagnose

jstack 32752

A deadlock occurred while observing the output
Insert picture description here

Guess you like

Origin blog.csdn.net/u014496893/article/details/114551142