Friday, January 6, 2012

How to analyse web logic thread dump?

I notice that there are some stuck threads.

I like to check what could be the cause of the stuck thread just base on the thread dump logs below. Any advise anyone? And also what is the difference between a fat lock and a thin lock?

        "[STUCK] ExecuteThread: '25' for queue: 'weblogic.kernel.Default (self-tuning)'" id=87495 idx=0x274 tid=15308 prio=1 alive, in native, blocked, daemon              -- Blocked trying to get lock: com/jnn/testController@0x135a26c0[thin lock] 

ANSWER:

One set of thread dumps alone wont be too helpful to get to the root cause. Take 4 or 5 sets of thread dumps at an interval of 5 seconds between each. so at the end you will have a single log file which has around 20 - 25 seconds worth of action on the app server.

Then you should look for you want to check is a stuck thread or long running transaction is happening, all the thread dumps will show a certain thread id is at the same line in your java stack trace. In simpler terms, the transaction (say in an EJB or database) is spanning across multiple thread dumps and hence needs more investigation.

Now when you run these through Samurai or TDA (I havent used TDA myself), it will highlight these in Red colour so you can quickly click on it and get to the lines showing issues.

See an example of this here. Look at the Samurai output image in that link. Green is fine. Red and grey need looking at.

In your case, thread 25 is blocked trying to get the lock on this object

com/jnn/testController@0x135a26c0  

Search the rest of the lock to see what is holding a lock on the same object, and see why it is not releasing the lock - this will be visible in the stack trace


No comments: