Tuesday 21 May 2019

Thread dump analysis


Healthy thread:

WAITING for request


java.lang.Thread.State: RUNNABLE

runnable


BAD threads

:

java.lang.Thread.State: BLOCKED (on object monitor) : waiting for monitor entry



Oks

java.lang.Thread.State: TIMED_WAITING (parking) :waiting on condition


java.lang.Thread.State: TIMED_WAITING (on object monitor) :Object.wait()


java.lang.Thread.State: TIMED_WAITING (sleeping) :waiting on condition



Thread dump analysis :
1.  Search for BAD threads , Blocked states etc
2. determine the pattern
   like if all of them are waiting for some object<Object_ID> will be printed in stack trace, search with that key.

3. If many threads are waiting for one one specific object,
    do a seach "locked <<Object_Id>>

   you will find, which thread is holding that objects lock.

4. Analyse the stack trace (always bottom up) of that culprit thread.
5. See what is the last step that culprit thread execute (top line of thread)

 If last steps, where this thread was blocked, relates to some JVM related things, like parsing XML, loading some class, logging or reading some file.
Its typically relates to excessive use of Heap, heap running out of memory.

Like some threads "Stuck/Bloacked" in "init" space, that means, they are not able to get the memory they wants, hence the operation is stuck..

CONCLUSION

In such cases, now you need to analyse you heap dump, to see if there are enough space, memory leak etc.


Source
 Java Thread ID ex: tid=0x000000011e52a800 ** This is the Java Thread Id obtained via java.lang.Thread.getId() and usually implemented as an auto-incrementing long 1..n*



 

No comments:

Post a Comment