Websphere application server (WAS) – Thread dump and Heap Dump


When to generate ? How to generate ? how to debug ?

Thread Dumps
If you get unexplained server hangs under WebSphere, you can obtain, from the WebSphere server, a thread dump to help diagnose the problem.

In the case of a server hang, you can force an application to create a thread dump.

On unix/Linux machines find the process id (PID) of the hung JVM and issue kill -3 PID.  Look for an output file in the installation root directory with a name like javacore.date.time.id.txt.
Using wasadmin prompt,
get the handle of the server
wsadmin>set jvm [$AdminControl completeObjectName type=JVM,process=server1,*]
execute
wsadmin>$AdminControl invoke $jvm dumpThreads

If an application server spontaneously dies, look for a file. The JVM creates the file in the product directory structure, with a name like javacore[number].txt.

Download thread analyzer from IBM website to analyze the generated thread dumps. (http://www.alphaworks.ibm.com/tech/jca)

Heap Dumps
A heapdump is a snapshot of JVM memory – it shows the live objects on the heap along with references between objects. It is used to determine memory usage patterns and memory leak suspects.

To enable automated heap dump generation support, perform the following steps in the administrative console: (heap dump will generated upon receiving the out.of.memory exceptios)

1. Click Servers > Application servers in the administrative console navigation tree.
2. Click server_name >Runtime Performance Advisor Configuration.
3. Click the Runtime tab.
4. Select the Enable automatic heap dump collection check box.
5. Click OK.

Generating Manually

use kill -3 PID on unix/linux machines.

Invoke the generateHeapDump operation on a JVM MBean, for example,
* Finding JVM objectName:
<wsadmin> set objectName [$AdminControl queryNames
WebSphere:type=JVM,process=<servername>,node=<nodename>,*]
* Invoking the generateHeapDump operation on JVM MBean:
<wsadmin> $AdminControl invoke $objectName generateHeapDump

heap dumps can be found under profile_root\profile-name with naming heapdump.<date>..<timestamp><pid>.phd
Use HeapAnalyzer or MDD4J for analyzing heap dumps

Note: we always generate multiple dumps with some interval gap and then compare them for analysis.

28 thoughts on “Websphere application server (WAS) – Thread dump and Heap Dump

  1. so a kill -3 gives both thread dump and heap dump? Is there anything I need to configure in the JVM arguments to get this output

  2. Hi,
    I think kill -3 doesn’t give Heap Dump. if we need to Invoke them manually we can use wsadmin commands.

    below commands generate Heap Dump

    serverJVM = AdminControl.queryNames(“type=JVM,process=,*”)
    AdminControl.invoke(serverJVM,”generateHeapDump”)

    we have to execute above commands from wsadmin command prompt choosing the language as jython.

    Please correct me if I am wrong.

    Regards,
    Pavan

  3. Hi,
    This is a bit weird, Yesterday when I issued “kill -3” on WAS 7.x version, it only created thread dump, but today when I issued the same command in WAS 8.x version, it has created both thread dump and heap dump.

    I need to check if it is version dependent.

    Regards,
    Pavan

  4. Hi,
    I am sorry for my previous comment, it was a mistake from my end, kill -3 was generating only thread dump on WAS 8.x as well, for Heap dump I have used the same wsadmin commands that I mentioned earlier.

    Regards,
    Pavan

  5. we use kill -3 pid in unix environment for generating both thread dumps and heap dumps but we need to set parameter like ibm_heapdump_true and ibm_heap_dump_true under server in adminconsole

  6. I believe that argument is OS specific, I am unable to start my jvm if I include this in my Generic JVM arguments. By the way I am on Solaris, what OS was this on where it worked?

  7. I tried in on Linux and updated the property in “Application servers > ServerName > Process definition > Environment Entries”, then restarted the server.

  8. > Java and Process Management > Process Definition> Environment entities.
    there you have to set these parameters
    – IBM_HEAPDUMP – True
    – IBM_HEAP_DUMP – True
    – IBM_HEAPDUMP¬¬OUTOFMEMORY – True
    – IBM_HEAPDUMPDIR _Heap

  9. thanks for entire process explanation to all & specially thanks to “Joseph Amrith Raj’s ” doing a such a great work for us.

  10. Can any one post about
    1. ” How to change domain name from one name(abc.com to xyz.com)……????”
    2. ” What exactly happen when we access one URL (Ex. http://www.google.com….. ) (Interms of Plugin part, Webserver part and Application….)???
    3. “How the URL will change from HTTP to HTTPS (What exactly will happen, which parameters to change) …??
    4.How Session management will work…(Jsessionid, Cloneid, cache, sessionid)….??
    5. cluster with 2 instances (A,B) all configurations are same and one inst A working properly but when user accessing inst B, evrytime it was asking username and password, WHY….???

    Please share your valuable answers….. Thanks to all in advance…..

  11. Hi friends in my evironment one of the server in dev automatically going down i have gone through all checks but issue is not fixed can any one help with with solution to fix the issue prmanantly

Leave a comment