Threads and stack trace (THREADS)
For the application programmer, one of the most useful pieces of a Java™ dump is the THREADS section, which shows a list of Java threads, native threads, and stack traces.
A Java thread is implemented by a native thread of the operating system. Each thread is represented by a set of lines such as:
3XMTHREADINFO "main" J9VMThread:0x000000000F010500, j9thread_t:0x000000000113AC30, java/lang/Thread:0x00000000E0030068, state:R, prio=5
3XMJAVALTHREAD (java/lang/Thread getId:0x1, isDaemon:false)
3XMTHREADINFO1 (native thread ID:0x814, native priority:0x5, native policy:UNKNOWN, vmstate:CW, vm thread flags:0x00000001)
3XMCPUTIME CPU usage total: 0.639604100 secs, user: 0.546003500 secs, system: 0.093600600 secs
3XMHEAPALLOC Heap bytes allocated since last GC cycle=245776 (0x3C010)
3XMTHREADINFO3 Java callstack:
4XESTACKTRACE at myLoop.main(myLoop.java:32(Compiled Code))
3XMTHREADINFO3 Native callstack:
4XENATIVESTACK ZwWaitForSingleObject+0xa (0x0000000077C612FA [ntdll+0x512fa])
4XENATIVESTACK WaitForSingleObjectEx+0x9c (0x000007FEFDAB10DC [KERNELBASE+0x10dc])
4XENATIVESTACK monitor_wait_original+0x83e (j9thread.c:3766, 0x000007FEF4C2600E [J9THR27+0x600e])
4XENATIVESTACK j9thread_monitor_wait+0x43 (j9thread.c:3492, 0x000007FEF4C26993 [J9THR27+0x6993])
4XENATIVESTACK internalAcquireVMAccessNoMutexWithMask+0x32c (vmaccess.c:320, 0x000007FEF1EDE02C [j9vm27+0x6e02c])
4XENATIVESTACK javaCheckAsyncMessages+0xe9 (async.asm:156, 0x000007FEF1E81609 [j9vm27+0x11609])
- Native operating system thread ID
- Native operating system thread priority
- Native operating system scheduling policy
- Internal VM thread state
- Internal VM thread flags
The Java thread priority is mapped to an operating system priority value in a platform-dependent manner. A large value for the Java thread priority means that the thread has a high priority. In other words, the thread runs more frequently than lower priority threads.
- R - Runnable - the thread is able to run when given the chance.
- CW - Condition Wait - the thread is waiting, because of one of the following conditions:
- The thread is blocked for I/O.
- A wait() method is called to wait on a monitor that is being notified.
- The thread is synchronizing with another thread with a join() call.
- S – Suspended – the thread is suspended by another thread.
- Z – Zombie – the thread is destroyed.
- P – Parked – the thread is parked by the new concurrency API (java.util.concurrent).
- B – Blocked – the thread is waiting to obtain a lock that something else currently owns.
If a thread is parked or blocked, the output contains a line for that thread, beginning with 3XMTHREADBLOCK. This line lists the resource that the thread is waiting for and, if possible, the thread that currently owns that resource. For more information, see Blocked thread information.
For Java threads and attached native threads, the output contains a line beginning with 3XMCPUTIME. This line displays the number of seconds of CPU time that was consumed by the thread since that thread was started. The total CPU time that is consumed by a thread is reported. If a Java thread is reused from a thread pool, the CPU counts for that thread are not reset, and continue to accumulate.
For Java threads, the line beginning with 3XMHEAPALLOC displays the number of bytes of Java objects and arrays that are allocated by that thread since the last garbage collection cycle. In the example, this line is just before the Java call stack.
If the Java dump was triggered by an exception throw, catch, uncaught, or systhrow event, or by the com.ibm.jvm.Dump API, the output contains the stored tracepoint history for the thread. For more information, see Trace history for the current thread.
exclusive_vm_access is shown in the 1TIPREPSTATE line of the
TITLE section.
1TIPREPSTATE Prep State: 0x4 (exclusive_vm_access)Threads that were running Java code when the Java dump was triggered have a Java thread state of R (Runnable) and an internal VM thread state of CW (Condition Wait).