Beruflich Dokumente
Kultur Dokumente
Thread dump analysis is the most important part to find out the Server slow responsiveness or
Hang Server Situation or sometimes a Crash scenario as well if happened because of the Stuck
threads. Here we are going to see some very basic but important features of WebLogic Thread
Model and the functionality and tasks performed by these Threads. Here we will talk about some
very common terminology which we use while analyzing the Thread Dump or Hang Server
Situation.
2). If a Server does not even response to the clients requests, then it is a Complete Server Hang
scenario. Some times the complete stuckness of a Server also may cause a Server Crash.
Cause 1). If the Free Heap memory is very less then the the Threads will NOT be able to create
required objects in the Java Heap.
Cause 2). Insufficient number of Threads. It happens some times that if the Load (number of
users request) on Server suddenly increased and the MaxThreadCount is not set to a correct
value then Server will not be able to process these many requests.
Cause 3). If the Garbage Collection is taking much time in that case the Garbage Data clean up
process will take longer time and the Threads will be doing Garbage Collection rather than
processing the clients request. Or the Threads will be waiting for some free memory to create
some objects in the heap.
Cause 4). Sometimes Java Code optimization also causes a temporary hang scenario, because
the code optimization is a little heavy process but useful for better performance.
Cause 5). Many Remote Jdbc Lookups can sometimes cause the Hang scenario.
Cause 6). In accurate JSP compilation settings. (recommended always precompile the JSPs
before deploying it to the production environments and the PageCheckSeconds must be set
correctly sothat the JSP compilation will not happen very frequently)
Cause 7). Application code Deadlock or Jdbc Driver Deadlocks or Vendor API Bug: When
threads waits in infinite loop to gain lock on objects… Example scenario below
Example:
1). Thread_A has Gained Lock on Object Obj_A
2). Thread_B Gained Lock on Object Obj_B
3). Now After performing some operations on Obj_A the Thread_A is trying to get Lock on
Obj_B (Obj_B is already locked by Thread_B currently)
4). Similarly after performing some operations on Obj_B the Thread_B wants to gain Lock on
Obj_A (Obj_A is already locked by Thread_A)
In Above Scenario Now Both the Threads are waiting for each other to release the Lock on their
object … but none of them is actually releasing the lock from the Objects which they Already
have Locked.
Cause 8). If the Number of File Descriptors are very less (insufficient resources) in this case also
we might face slow server response or Server Hang situations.
How the Server Log will Look like in case of Hang Scenarios
or Slow Responsiveness?
By Default 600 Seconds (10 Minutes) is the default duration after which the WebLogic Server
declares a Thread as a STUCK Thread. The Entry of Stuck Thread occurance can be seen in the
Server Logs. You can see following kind of entry in the Server Logs…
Weblogic will just report the thread as stuck and in case the thread progresses(may be it seemed
to be stuck but was actually running a long transaction), weblogic would declare it as unstuck.
Many times it happens that our Application requirement says that a Thread can take more time to
process the Clients request (more than 600 Seconds) In that case we can change the
“StuckThreadMaxTime” interval. Example if we know that our Application has some long
running Jdbc queries which may take upto 900 Seconds then we can increase the
StuckThreadMaxTime.
Debugging-2). As soon as you get time check the Verbose GC Logs (Garbage Collection Logs if
you have already enabled the Garbage Collection Logging by applying the following
JAVA_OPTIONS)
set JAVA_OPTIONS=%JAVA_OPTIONS% -Xloggc:/opt/logs/gc.log -XX:
1
+PrintGCDetails -Xmx1024m -Xms1024m
Debugging-3). Collect at least 4-5 Thread Dumps taken in the interval of 9-10 seconds each to
see the Activities of Threads. Follow the various ways of collecting Thread Dumps:
http://middlewaremagic.com/weblogic/?p=823
Debugging-4). Check If the Load (Number of Clients Request) is/was abnormally very High on
the Server?
Debugging-5). Check if the JMS Subsystem connectivity or the Database connectivity is lost
somewhere… You may find in the Server Logs some Strange entries like DataSource is
Disables/ Network Adapter could not Establish Connection to the Database/ JMS Messaging
System “PeerGoneException” ….. Tuxedo/Jolt Connectivity Errors…etc.
.