Matching Java Thread NID & TID to Solaris 10 Threads using 'pstack'
Tags:
To trace a java thread from a thread dump to the corresponding thread on Solaris 10, you can find the LWP using pstack by converting the NID (which corresponds to the LWP ID on Solaris) and matching it up in the pstack output, or by finding the TID listed in the pstack output.
For example, I ran a thread dump and I want to trace this thread from the dump:
"ExecuteThread: '2' for queue: 'weblogic.kernel.System'" daemon prio=5 tid=0x00880588 nid=0x35 in Object.wait() [aba7f000..aba7fc30] at java.lang.Object.wait(Native Method) at java.lang.Object.wait(Object.java:429) at weblogic.kernel.ExecuteThread.waitForRequest(ExecuteThread.java:154) - locked <0xb8c194b0> (a weblogic.kernel.ExecuteThread) at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:174)
The parts I am interested in are the TID and NID:
tid=0x00880588 nid=0x35
First, I need to convert the NID from hexadecimal to decimal, and I'll use 'bc' like so:
echo 'ibase=16;obase=A;35' | bc 53
Where the '35' in the echo line is from "nid=0x35" (the "0x" just denotes that the number '35' is in hex)
so the NID, in decimal, is 53.
Now, if I run pstack on the process, and I search for "thread# 53", I will find this (I have stripped all unrelated output):
----------------- lwp# 53 / thread# 53 -------------------- ff2bd8dc lwp_cond_wait (20c0a0, 20c088, 0, 0) fecd7900 __1cNObjectMonitorEwait6MxipnGThread__v_ (4800, 4b3c, 4800, 4a20, 880588, 4560) + 54c fecd6e38 JVM_MonitorWait (88061c, aba7f9fc, 0, 0, 0, 0) + 138 fa3ef9e0 ???????? (b8c194b0, aba7fa08, b89da8a0, b89dab28, b9e06c38, b3affe90) f9f1f8b0 ???????? (b8c194b0, b8c194b0, 17, 8, f9c13848, b8c194b0) fa5cc310 ???????? (b8c194b0, 1, 2, f9c146c0, b346f718, b8c685f0) f9c70b78 ???????? (aba7fba8, 0, 0, f9c15270, 33eed0, aba7fb48) f9c00118 ???????? (aba7fc30, aba7fe98, a, f1f8efb0, f9c0aae0, aba7fdb8) fecc7fc8 __1cJJavaCallsLcall_helper6FpnJJavaValue_pnMmethodHandle_pnRJavaCallArguments_pnGThread__v_ (aba7fe90, aba7fcf8, aba7fdb0, 880588, 880588, aba7fd08) + 274 fecd6958 __1cJJavaCallsMcall_virtual6FpnJJavaValue_nLKlassHandle_nMsymbolHandle_4pnRJavaCallArguments_pnGThread__v_ (feffa000, 888950, aba7fda4, aba7fda0, aba7fdb0, 880588) + 164 fecd67e4 __1cJJavaCallsMcall_virtual6FpnJJavaValue_nGHandle_nLKlassHandle_nMsymbolHandle_5pnGThread__v_ (aba7fe90, aba7fe8c, aba7fe84, aba7fe7c, aba7fe74, 880588) + 60 fecd676c __1cMthread_entry6FpnKJavaThread_pnGThread__v_ (880588, 880588, 877928, 888950, 3239f4, fecd6570) + 128 fecd6598 __1cKJavaThreadDrun6M_v_ (880588, 35, 40, 0, 40, 1) + 288 fecc685c _start (880588, aba80000, 0, 0, fecc6728, 1) + 134 ff2bc610 _lwp_start (0, 0, 0, 0, 0, 0)
So this is the thread I'm looking for.
The TID "tid=0x00880588" is also listed in the line close to the bottom, where it says "_start"
fecc685c _start (880588, aba80000, 0, 0, fecc6728, 1) + 134
- theCamel's blog
- Add new comment
- 1517 reads
