Skip to Main Content

Java HotSpot Virtual Machine

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

thread dumps on fatal JVM error without intervention

954317Mar 6 2013 — edited Mar 14 2013
Hi All,
I tried testing out the optional commands that are allowed on the JVM options to create thread dumps on fatal JVM error. Below are 2 cases to create a thread dump using kill -3 command 1) is when an OOM error occurs and 2) when any fatal error occurs and JVM goes down.
As you see from the output below, on OOM error the kill -3 command is working from “executing kill -3 9644’ where, %p is replaced by process id 9644. The same is not true for the case for OnErrror, my assumption was the OnError is triggered for all errors including OOM error. I am going to post the same to JVM news groups and check if, I can get help from there.
This is closest I have found to trigger a thread dump on fatal JVM error without intervention.

Thanks
1)

d:\Development\examples>java -D64 -XX:OnOutOfMemoryError="kill -3 %p " -Xmx10m -Xloggc:gc.log OOM
#
# java.lang.OutOfMemoryError: Java heap space
# -XX:OnOutOfMemoryError="kill -3 %p "
# Executing "kill -3 9644 "...
Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
at OOM.main(OOM.java:6)

2)
d:\Development\examples>java -D64 -XX:OnError="kill -3 %p " -Xmx10m -Xloggc:gc.log OOM
Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
at OOM.main(OOM.java:6)
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 11 2013
Added on Mar 6 2013
5 comments
3,905 views