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 6.1 -> 8.5

To manually generate heapdumps, set a JVM parameter. Then send the JVM process an interrupt (signal 3), a javacore and a heapdump will be generated.

In the Administrative Console:

    • Servers > Application Servers >

serverName

    • :
    • In the Server Infrastructure section open Java and Process Management, then select Process Definition:
    • In the Additional Properties select Javaâ„¢ Virtual Machine:
    • Add the following string to the Generic JVM arguments field:

      • -Xdump:heap:events=user
    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>

This will not “kill” the Application Server process, it just sends the process a signal 3.

WebSphere Application Server V6.0.2, V5.1.1

To manually generate heapdumps, set an environment variable. Then when an interrupt (signal 3) is sent to the JVM process, a javacore and a heapdump will be generated.

The environment variable is: IBM_HEAPDUMP
And the value it should be set to is: TRUE

See the following page for directions on setting an environment variable:“Setting environment entries in WebSphere Application Server”
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>

This will not “kill” the Application Server process, it just sends the process a signal 3

Advertisements