/ Stuck Thread how to resolve part 1 ~ Java EE Support Patterns

8.18.2011

Stuck Thread how to resolve part 1

In my Java EE production support experience, stuck threads is by far the most common production problem you will face in your day to day work. Some of these problems are straightforward while others are very complex to pinpoint. This issue is quite common, regardless of the Java EE server that you use (Weblogic, WAS, JBoss etc.).

This article is the part #1 of a series of articles which I will share with you my knowledge on stuck Thread related problems; including root cause analysis, which tools to use, how to take corrective actions and how to prevent stuck Threads at the first place. So please come back regularly for more updates on this topic.

For now, let’s start with the basics and understanding of Thread Pools in the Java EE container world.

Java EE container and Thread Pools

Thread Pools are part of the foundation of your Java EE container. Every new request that comes in to your application server will at some point require a Java Thread allocation in order to execute its task. Executing each request in its own separate Java Thread provides the container with multi Thread and concurrent processing capabilities.

Find below a simple diagram showing you an example of 2 concurrent HTTP requests reaching a Weblogic 11g server:

Why are Threads getting stuck?

As you can see from the diagram, the Threads are executing the actual allocated request from the Weblogic Kernel. Most of the problems happen when the Thread execution is reaching the application or business layer.

At this point your application Java code modules will be performing a lot of business logics, including sending and receiving data from external sources such as a Web Service or an Oracle database for example. Any problem with such external system will cause the Thread to hang and wait for data to come back.

Other situations can occur such as internal deadlock, infinite looping, heavy IO contention on your server etc.


What can you do about it?

Please note that I'm currently working on a Thread Dump analysis training plan available from this Blog. I highly recommend that you read it; I'm confident that it will greatly improve your Thread Dump analysis skills and help you prevent and resolve stuck Thread problems.

Finally, please feel free to submit your Thread Dump data to the Root Cause Analysis Forum or via my email address @phcharbonneau@hotmail.com and I will analyze it for you.

2 comments:

I am sending request to the server side component.. It will take time to execute.. In weblogic server create one more thread for the same process. how to avoid that.. if u have any idea pls share me

Hi Vel,

It would depend what component of Weblogic is executing the request. Would you have an execution strack trace such as Thread Dump showing such Thread in action?

Thanks.
P-H

Post a Comment