Salesforce

How to gather heap and thread dump for the Adminserver java process

« Go Back

Information

 
TitleHow to gather heap and thread dump for the Adminserver java process
URL NameHow-to-gather-heap-and-thread-dump-for-the-Adminserver-java-process
Article Number000172858
EnvironmentProduct: OpenEdge
Version: 11.x
OS: All Supported Platforms
Question/Problem Description
How to gather heap and thread dump for the Adminserver java process
How to create heap dump and/or thread dump against a java executable
How to take heap dumps from a JVM using jmap tool.
How to take thread dumps from a JVM using jstack tool.
Steps to Reproduce
Clarifying Information
Error Message
Defect Number
Enhancement Number
Cause
  
 
Resolution
What is a Heap dump ?
A heap dump is a snapshot of the memory of a Java process at a certain point of time. The snapshot contains information about the java objects and classes in the heap at the moment the snapshot was triggered. 

What is a Thread dump dump ? 
A thread dump is a snapshot of the state of all threads that are part of the process. The state of each thread is presented in a stack trace, which shows the contents of a thread’s stack. This is especially useful if application seems stuck, or is running out of resources, a thread dump will reveal the state of the server.

How to create heap dump and thread dump
 
Once the AdminServer has started up, to get heap dump and/or thread dump take a snapshots with both jmap to see what changed and with jstack if something is blocked. 

Step 1: Find the PID of the java process
  • Java JDK ships with the jps command which lists all java process ids running on the machine including the PID of the process.
  • <DLC>\jdk\bin\jps -l -m -v 
  • Example, the adminserver is running on PID 912
    912 com.progress.chimera.adminserver.AdminServerStarter -port 20946 -adminport 7846 ... 

Step 2: Request a Thread Dump from the JVM
  • The jstack tool prints thread dumps to the command line console or a file, 
  • The thread dumps can be used to see which threads are blocked 
  • The -l argument provides additional "Locked ownable synchronizers" for each thread 
  • To obtain a thread dump using jstack, use the PID of the AdminServer java process (912) to run the following command at least 5 times over a few seconds interval, changing the output filename:
    <DLC>\jdk\bin\jstack -l 912 >> admserv.jstak_912_1 

Step 3: Request a Heap Dump from the JVM
  • The jmap tool it prints out what is in the memory to see what changed to the command line console or a file.
  • To obtain a heap dump using jmap, use the PID of the AdminServer java process (912) to run the following commands :
a. With -heap to see the java heap summary: 
<DLC>\jdk\bin\jmap -heap 912 >> admserv.jmap912_1
          
b.
With -dump to dump the full java heap:
<DLC>\jdk\bin\jmap -dump:file=admserv912_1.dump 912 
        
or in hprof binary format. There are several tools available to review the binary content, like jvisualvm (https://visualvm.github.io/) or Eclipse's Memory Analyzer (https://www.eclipse.org/mat/downloads.php) for example: 
<DLC>\jdk\bin\jmap -dump:format=b,file=admserv912_1.bin PID 

On AIX

The methods are different for IBM Java.
 
Find the PID of the AdminServer java process:

$  ps -ef | grep java | grep AdminServer

kill -3 <AdminServerPID> 

A file will be created with the format: javacore.<date>.<time>.<PID>

When a full heap dump is needed:

1 - Identify the AdminServer PID

ps -ef | grep Java | grep adminServer

or follow this article from IBM https://www.ibm.com/support/pages/finding-which-program-using-port-aix

2 - Generate a core file

gencore <pid> <output filePath>

3- Generate a ZIP file from the dump:

$JAVA_HOME/jre/bin/jextract <coreFilePath>
 
Workaround

 
Notes
Keyword Phrase
Last Modified Date2/2/2022 7:47 PM

Powered by