Using Heapdumponoutofmemoryerror Parameter for Heap Dump for Jboss

Using HeapDumpOnOutOfMemoryError parameter for heap dump for JBoss

Here's what Oracle's documentation has to say:

By default the heap dump is created in
a file called java_pid.hprof in the
working directory of the VM, as in the
example above. You can specify an
alternative file name or directory
with the -XX:HeapDumpPath= option. For
example -XX:HeapDumpPath=/disk2/dumps
will cause the heap dump to be
generated in the /disk2/dumps
directory.

Java EE heap dump on Out of Memory

How do I get this working in jave ee? Also should i get the heap dump when throwing new OutOfMemoryError?

If you're using JBoss, you should see the server.log and see if the exception is EJB or OOME, then try to fix it.

So we have:

How do I get this working in jave ee? See the exception.
Also should i get the heap dump when throwing new OutOfMemoryError? Yes, if you're correctly using the flag: -XX:+HeapDumpOnOutOfMemoryError

JAVA/OOM: How to dump all information on java heap space when it crashes due to OOM?

Use the HeapDumpOnOutOfMemoryError and HeapDumpPath options to generate a heap dump when an OutOfMemoryError occurs in the JVM.

For example:

$ java -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/some/path MyApp

If you suspect a memory leak, you can use jmap, which is included with the JDK, to produce a heap dump of your application while it's running.

For example:

jmap -dump:live,format=b,file=dump.hprof <pid>

You can then analyze dump.hprof using an application such as YourKit to pinpoint what code is causing the leak.

References

  1. https://docs.oracle.com/javase/8/docs/technotes/guides/troubleshoot/clopts001.html

  2. https://docs.oracle.com/javase/8/docs/technotes/guides/troubleshoot/tooldescr014.html

How can I restart JVM on OutOfMemoryError _after_ making a heap dump?

java -XX:+HeapDumpOnOutOfMemoryError -XX:OnOutOfMemoryError="kill -9 %p" TestApp

JVM will dump heap first, and then execute OnOutOfMemoryError commands (proof).



Related Topics



Leave a reply



Submit