Wednesday, June 13, 2012

WebSphere OutOfMemory Errors


WebSphere OutOfMemory Errors


If your WAS deployment is experiencing OOM issues you can setup the JVM to produce a system dump when the OOM event occurs. This system dump can later be jextracted and sucked into Eclipse Memory Analyzer to do offline analysis.
There are a variety of ways to obtain a dump from the IBM software development kit and various formats for the dump produced. It important to understand the content of each of the dumps so that the correct one can be selected for analysis of a given problem. In essence there are three forms of dump:

  • A system dump which is a complete dump of all the information in a process. The Dump Analyzer requires this form of dump to perform analysis. 
  • A heap dump which gives a more terse view of the objects in the heap but does not include thread and monitor information. This form of dump is of use to other tools for heap analysis. 
  • A summary dump sometimes called a javacore file. This is a human readable dump designed to summarise the state of the process in high level terms; the threads, monitors etc. 
Dumps are produced by the JVM either on demand (a signal from the user) or on event (something happening within the VM). When the JVM starts it registers a number of event handlers which cause dumps to be generated for a default set of events. In the case of an Out of Memory event a heap dump is generated, for a user signal a javacore is generated and for a JVM crash a system dump is generated. For detailed information on setting the JVM options that control dump production.

To generate a system dump automatically on an OOM you will need to set the following  JVM generic argument:-Xdump:system:events=systhrow,filter=java/lang/OutOfMemoryError,request=nodumps+exclusive+prepwalk

In order to generate java core dump, system core dump, heap dump and a snap dump at user signal, the dump agents must be configured through JVM options as follows.-Xdump:java+heap+system+snap:events=user


You can have multiple -Xdump options on the command line. 
-Xdump agents are always merged internally by the JVM, as long as none of the agent settings conflict with each other.
 

-Xdump:java+heap+system+snap:events=user -Xdump:system:events=systhrow,filter=java/lang/OutOfMemoryError,request=nodumps+exclusive+prepwalk

-X options are specified as generic JVM arguments on WebSphere Application Server 6.1 as follows:
In the Administration Console select Servers
  1. Select Application Servers
  2. Click on the name of your server
  3. In the Server Infrastructure section, expand Java and Process Management and select Process Definition > Java Virtual Machine
  4. Scroll down and locate the textbox for Generic JVM arguments.
Please also see Crash on AIX produces no core or a truncated core   to prevent a truncated core from being generated on AIX. 

Please note these events ONLY work for IBM Java5 and Java6 JVMs. 
Happy debugging :-)

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.