title: How to obtain the JVM thread name/id through the known PID/TID
body: <p>Yesterday we had a weird problem with our tomcat 6 server which is running on Debian: We had second long freezes/outages that increased in length over time. In the frozen periods all our independent web apps were unresponsive. The outages had a very high regularity and over the course of one hour the outage phases became longer than the active phases, until we restarted the server which solved the problem. Now we want to find out what it was or find a solution to find out what it is if it happens again!<br><br>
  During each outage phase one of the 24 cores was used 100% by one of the tomcat threads, so we assume whatever that thread was doing was freezing the whole tomcat. Sadly we have no idea what that thread was working on. Today I researched a solution to get the TID of a java thread and I found a wonderful solution: <a href="https://stackoverflow.com/questions/11224394/obtaining-the-thread-id-for-java-threads-in-linux">Obtaining the thread ID for Java threads in Linux</a> .<br><br>
  Putting it in our extensive log file entries and finding the JVM thread would be easy enough, but what if it's a thread that isn't exactly under our control? And what about the annoyance of having a synced TID / Java-Thread-ID snapshot? This leads to my core question:<br><br><b>Is there a way to get the JVM Thread name/id from a known Linux TID?</b><br><br>My hopes are small, but maybe there is a cross process call to the JVM or another idea I haven't considered yet.<br><br>
  We have the Yourkit profiler running on that server, but during the outage phases it wasn't able to record anything, so we couldn't find the offending thread.</p>