how to get a thread dump for java in linux ?
- User
how to get a thread dump for java in linux ?
Assistant
You can get a thread dump for a Java process in Linux by using the jstack utility. The steps are:
-
Find the PID of the Java process. You can use the ps -ef | grep java command to find the PID.
-
Run the jstack PID command. For example, if the PID is 1234, you would run:
jstack 1234- This will print the thread dump for the Java process with PID 1234. It will look something like this:
2020-04-27 11:44:46 Full thread dump Java HotSpot(TM) 64-Bit Server VM (25.191-b12 mixed mode): "Attach Listener" #10 daemon prio=9 os_prio=31 tid=0x00007f91c800a800 nid=0x4d03 waiting on condition [0x0000000000000000] java.lang.Thread.State: RUNNABLE "http-nio-8080-exec-10" #9 daemon prio=5 os_prio=31 tid=0x00007f91c8012800 nid=0x4d02 waiting on condition [0x0000000000000000] java.lang.Thread.State: WAITING (parking) at sun.misc.Unsafe.park(Native Method) - parking to wait for <0x000000076c065610> (a java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject) at java.util.concurrent.locks.LockSupport.park(LockSupport.java:175) ...-
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.