Page tree
Skip to end of metadata
Go to start of metadata

Problem

Want to get Heap dump from server node java process, but do not know how to do it.

Symptom

  • Some memory leak is observed, but cannot be allocated without heap dump.
  • Want to produce heap dump.
  • OutOfMemory

Keywords

  • Heap dump
  • Memory analyzer

Description

You need to produce heap dump. Need instructions step by step what to do.

Background:
To make a heap dump in server node java process, nevertheless there were
or there weren't OutOfMemory, you have two properties in JVM (Java Virtual Machine)

-XX:{+ -}HeapDumpOnCtrlBreak (current value: -)
                  dump heap to file in Ctrl-Break handler
-XX:{+ -}HeapDumpOnOutOfMemoryError (current value: -)
                  dump heap to file when java.lang.OutOfMemoryError is thrown
-XX:HeapDumpPath=<value>
                  when HeapDumpOnOutOfMemoryError is on, the path (filename or directory)
                  of the dump file (defaults to java_pid<pid>.hprof in the working directory)

For our purposes it is enough to use the first property. We will search generated heap dump
java_pid<PID>@COUNT.hprof file in: _\usr\sap\<SID>\<Instance_name><Instance_number>\j2ee\cluster\server<X>
for server node <X>.

Solution

To enable heap dump - read and apply following steps:

Step 1
Open config tool

Step 2
Navigate to "additional properties"

Step 3
Add new Additional property without value, with name:
-XX:+HeapDumpOnCtrlBreak

Step 4
Save configuration in config tool. (And close it.)

Step 5
Restart the cluster in order to apply the new property.
(Starting of java process with added property will enable heap dump for current java process)

To get the heap dump afterwards, follow next steps:

Step 1
Open MMC

Step 2
Navigate to "AS Java Process Table"

Step 3
Select server node, which heap dump you want (server0 / server1).
From context menu select "Dump Stack Trace"

Step 4
Your *.hprof file with heap dump is generated in folder for server process that you have selected:
For server process 0 - see in folder: \usr\sap\<SID>\<Instance_name><Instance_number>\j2ee\cluster\server0\
Search for file like this one: java_pid11984_@COUNT.hprof (where 11984 is the PID <Process ID> of java process for server node in OS).

To open and analyze produced heap dump afterwards read steps:

You already have java_pid<PID>_@COUNT.hprof file and need to analyze gathered information.
Step 1
Open MemoryAnalyzer

Step 2
Navigate in menu: File -> Open Heap Dump... or File -> Open File...
New window with browser will appear asking where is stored *.hprof file with heap dump.

Step 3
Navigate to produced heap dump file and click "Open" button.
Analyze the results.

NOTE: Plug-in for NWDS may throw OutOfMemory, when it opens a big heap dump. So it is recommended to use standalone memory analyzer application.
NOTE: If you have no installed memory analyzer, you should refer to links in Related External References below.

The symbols used on this page have the following meaning:

  • <SID> as the name of the SAP "System ID". For instance: J2E, Q1M, PT1, etc.
  • <Instance_Name> as the name of the instance. For example: J, JC, DVEBMGS, D.
  • <Instance_Number> as the number of the instance. For example 00, 60, 01, 40, 90, etc.
  • <X> as the number of the server process in particular instance. For example 0, 1, 2, etc.
  • No labels