How do I identify a thread in a java process when the native thread id doesn't match any of the threads listed in a thread dump?
Context: Running on Windows, I'm currently using the Sysinternals Process Explorer to monitor the java.exe running the tomcat host for a webapp that we use in our lab. We're currently watching this because the CPU profile has been crazy of late.
When the server is unresponsive, I look at the Properties of the java image, and switch to the thread tab, and order it by the CPU column. There will typically be one TID - for example 62504 - parked at or near the top of the list. I convert the TID to its hex representation (F428), check the thread dump - sure enough 开发者_运维技巧"VM Thread" prio=10 tid=0x33d45000 nid=0xf428 runnable
That makes me think that my method for mapping ids is adequate.
But because we're focused on CPU right now, I'm also interested in native thread 61136, which in an hour of running was more than 5 minutes of kernel time. 61136 -> 0xEED0, but none of my thread dumps ever include an nid=0xeed0 entry.
Edit: further testing reveals that StartAddress is a critical piece of information - all of the msvcr71.dll threads appear in the dump or have very short lifetime, but threads in other modules (mswsock.dll, kernel32.dll) do not appear. The main thread comes from java.exe, but there are other threads in that module which do not appear in the thread dump.
61136 -> 0xEED0
(That last 0 is a zero, not an uppercase O). Is this a typo in your SO post, or have you made this mistake in your code/application?
精彩评论