IBM Support

How to manually generate a Heapdump in WebSphere on AIX and Linux

Troubleshooting


Problem

How to manually generate a heapdump without waiting for an OutOfMemoryError condition to occur.

Resolving The Problem

Occasionally a heapdump needs to be generated without waiting for an OutOfMemoryError condition to occur.

For example: an OutOfMemoryError will probably cause a system outage. On a production system this is not a desired event. Manually create a heapdump before the OutOfMemoryError generates one, then the Application Server can be recycled and result in a heapdump without an unscheduled outage.
The manually generated heapdump will not be as useful as one which was generated by an OutOfMemoryError, but sometimes it can be of some use. The longer you wait before generating the heapdump, the more likely the heapdump will contain the objects causing the OutOfMemory. If the heapdump is generated too soon, the largest memory user is not likely to be the same largest memory user as when the heap is completely full.



 
WebSphere Application Server V7 -> V9
For WebSphere 8 and later on AIX, Linux and Windows, you can collect heapdumps (or a core dump if needed manually via the Administrative Console:

Procedure
In the navigation pane, click Troubleshooting > Java dumps and cores.
Select the server or servers you need to collect a dump or core from.
Click System Dump or Java Core or Heap Dump depending on your need.
** Note: This is the preferred way to manually capture heapdumps because it doesn't require a restart, and doesn't require additional JVM arguments to be set.

If you are having a problem where you can't get to the Administrative Console, or if you are on WebSphere V7.0, then you'll need to add the -Xdump argument below as a Generic JVM argument, restart the JVM and be prepared for the next event.  These instructions are only for AIX and Linux, since Windows doesn't have a "kill -3" function.
To manually generate heapdumps, set the -Xdump Generic JVM Argument using the following instructions:

In the Administrative Console:
  1. Servers > Server Types, WebSphere application servers > serverName:
  2. In the Server Infrastructure section open Java and Process Management, then select Process Definition:
  3. In the Additional Properties select Java™ Virtual Machine:

Add the following string to the Generic JVM arguments field:
  • -Xdump:heap:events=user,request=exclusive+prepwalk+compact
Press OK, and save the configuration.
** Note: The Application Server will need to be recycled for the setting to take effect.


To generate the heapdump, send the Application Server an interrupt. Use the "kill" command:
  • kill -3 <java process ID>
    Example: If the current process ID (pid) is 23456, then run the command:  kill -3 23456
This will not "kill" the Application Server process, it just sends the process a signal 3 and will create a heapdump and a javacore.
** Note: We suggest removing this JVM argument when done diagnosing the issue.  We have performance scripts that perform a kill -3 30 seconds apart, and generating heapdumps will a) Skew the data to make it difficult if not impossible to diagnose and b) Will create a lot of overhead on the system, possibly being disruptive to your end users.
 
 

[{"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Product":{"code":"SSEQTP","label":"WebSphere Application Server"},"Component":"Out of Memory","Platform":[{"code":"PF002","label":"AIX"},{"code":"PF016","label":"Linux"}],"Version":"9.0;8.5.5;8.5;8.0;7.0","Edition":"","Line of Business":{"code":"LOB45","label":"Automation"}}]

Document Information

Modified date:
09 January 2020

UID

swg21297060