How to collect a Java heap dump using jmap and jstack to troubleshoot Out Of Memory errors with the TIBCO BusinessWorks ProcessMonitor(BWPM) server.

How to collect a Java heap dump using jmap and jstack to troubleshoot Out Of Memory errors with the TIBCO BusinessWorks ProcessMonitor(BWPM) server.

book

Article ID: KB0093295

calendar_today

Updated On:

Products Versions
TIBCO BusinessWorks ProcessMonitor -
Not Applicable -

Description

Description:
When you get Out Of Memory errors in the TIBCO BusinessWorks ProcessMonitor(BWPM) server's log file, and in order to troubleshoot this issue, we have to collect Java dumps. The tools/utility available from Java (SDK not JRE)  to collect heap dumps is jmap and jstack.

Issue/Introduction

How to collect a Java heap dump using jmap and jstack to troubleshoot Out Of Memory errors with the TIBCO BusinessWorks ProcessMonitor(BWPM) server.

Resolution

Create a heap dump from the running Java application (Tomcat server where TIBCO BusinessWorks ProcessMonitor(BWPM) is deployed) using the following command line tools available from JAVA (SDK) 1.6 or higher. 

1). Using  jmap - jmap is a command line tool used to get information about the memory map of a running Java application. To create a heap dump, execute the following line from a DOS prompt:


jmap.exe -dump:format=b,file=c:\temp\HeapDump.hprof <pid>

pid is the ID of the Java process. The JDK offers another tool called jps to list the IDs of all running Java processes. Executing jps.exe on the command line should print out something like this:
4711 jps
8442 Bootstrap


The Java process called Bootstrap is the running Tomcat server.


2).  Using jstack - Sun's JDK (not JRE) ships with a program called jstack (or jstack.exe on Microsoft Windows), which will give you a thread dump on standard output. Pipe the output into a file to produce a thread dump. You will need the process id ("pid") of the process to create the dump. Use of the program jps (jps.exe on Microsoft Windows) can help you determine the pid of a specific Java process.


Syntax:


  jstack -l <pid> > threaddump.txt
  or
  jstack <pid> > threaddump.txt

Generated heap dump files (threaddump.txt and HeapDump.hprof)  will have details which will aid in further investigation of the issue.

Additional Information

Web References:


1) Configure heap dump on Out Of Memory errors - http://blog.denevell.org/tomcat7-heap-dump-out-of-memory.html and http://wiki.apache.org/tomcat/HowTo#How_do_I_obtain_a_thread_dump_of_my_running_webapp_.3F .


2). jmap: http://eclipsesource.com/blogs/2013/01/31/creating-tomcat-heap-dumps-on-windows/ .


3). jstack http://support.jamasoftware.com/entries/20535318-Performing-a-thread-dump-in-Linux-or-Windows .