Hi,

Jay SenSharma

Jay SenSharma

Thread Dumps are one of the very important JVM reports which we can use to analyze Server/JVM Hang Situations and the Root Cause of it… Here are few very common techniques which we can use to take Thread Dumps…

Note: Taking only one or two Thread Dumps is not very useful. Always make sure that you collect atleast 5-6 Thread Dumps taken in the interval of 10-12 Seconds….Ehich will be really helpful to investigate the Hang Situation.

————————————————–

Option 1). In Windows Machines:   Just Press (Ctrl + Break) Buttons together in the CommandWindow ehere your Server in running.

In Solaris/Linux …etc Unix Based Boxes you need to findout the Servers Process ID…by running the following command from the Same box where the Server is running:

A). ps -ef | grep java

qProcessbox 20650 1   0   Mar 26 ?         104:51 /opt/app/qProcessbox/java/jdk1.5.0_22/bin/java

B). Now use     kill -3 20650

Syntax:  kill -3 <ProcessID>

The OutPut of the Thread Dump will be generated in the Server STDOUT.

————————————————–

Option 2). We can Collect Thread Dump Using “weblogic.Admin” which is deprecated …but still available …and may be available in near future as well…As i think because it is one of the best debugging utility for Admins.

java weblogic.Admin -url t3://AdminHostName:7001 -username weblogic -password weblogic THREAD_DUMP

java weblogic.Admin -url t3://MS1HostName:7003 -username weblogic -password weblogic THREAD_DUMP

java weblogic.Admin -url t3://MS2HostName:7005 -username weblogic -password weblogic THREAD_DUMP

The THREAD_DUMPS will be generated in the Servers STDOUT file.  If you want to See the Thread Dump In your Same Command Window Where you are running the “weblogic.Admin” utility…then Enable the “redirect-stdout-to-serverlog” Or by adding the JAVA_OPTION in serverStartScript (-Dweblogic.log.RedirectStdoutToServerLogEnabled=true) flag from Admin Console…sothat the STDOUT entries also will be redirected to the Server Logs…then you can read The Server Logs using the following command remotely/locally.

java weblogic.Admin -url t3://MS2HostName:7005 -username weblogic -password weblogic SERVERLOG
————————————————–

Option 3). Through WLST you need to write the WLST script like “AdminThreadDump.py” In this case you will see the Thread Dumps on the Same Shell Prompt…. not need to look into the Server STDOUT

connect('weblogic','weblogic','t3://localhost:7001')
cd ('Servers')
ls()
cd ('AdminServer')
ls()
threadDump()
cd('..')
cd('ManagedServerOne')
threadDump()

Now open a command Shell and then run the “setWLSEnv.sh”

then run the WLST script like:

java weblogic.WLST AdminThreadDump.py
or
java weblogic.WLST /opt/bea/MyScripts/AdminThreadDump.py
=====================================

Option 4). Simplest option to take Thread  Dump is :

Login to AdminConsole—>Server —> Monitoring —> Threads

Option 5). You can even collect THREAD_DUMPS using JMX code like mentioned in the below link …using “JVMRuntimeMBean”     taking-threaddump-along-with-jrockitruntime-details/

Option 6). Taking ThreadDump Using T3ServicesDef

Option 7). Collecting Thread Dumps Using Jstack utility

Option 8). If you are using WebLogic Server as a Windows Service then you can collect the Thread dump as Described by Former GSS India Oracle Mentor SriDevi :http://middlewaremagic.com/weblogic/?p=823#comment-1011

Option 9). Taking the JVM Details (Heap size and Jdk Details including OS details) including Thread Dump:

java weblogic.Admin -url t3://ServerHostName:7001 -username weblogic -password weblogic GET -pretty -type JVMRuntime

Collecting Thread Dump Using JVMRuntime

Collecting Thread Dump Using JVMRuntime

.

.

Thanks

Jay SenSharma