-
Enhancement
-
Resolution: Won't Fix
-
P3
-
9
This is an enhancement request to add a new JVM option 'OnException' that can be used to trigger some action when a given Java exception is encountered by the process.
We already have AbortVMOnException which when enabled aborts the
JVM generating hs_err and core file when the specified exception occurs. e.g.
java -XX:+UnlockDiagnosticVMOptions -XX:AbortVMOnException=InvalidClassException -XX:AbortVMOnExceptionMessage="class invalid for deserialization"
The idea is to add a more generic option OnException that upon the occurrence of a specified exception can run -
(a) generic commands, like:
-XX:OnException=exception=InvalidClassException,message="class invalid for deserialization",cmd="kill -9 %p"
(b) can also accept some pre-defined actions like dumpJfr, dumpCoreAndAbort, dumpCoreAndContinue, dumpHeap, dumpThreads etc.
-XX:OnException=exception=InvalidClassException,message="class invalid for deserialization",action=dumpJfr
This would be very useful in troubleshooting the Java/JVM failures that just result in printing the exception message and stack trace, and where we need more data to investigate the problem.
We already have AbortVMOnException which when enabled aborts the
JVM generating hs_err and core file when the specified exception occurs. e.g.
java -XX:+UnlockDiagnosticVMOptions -XX:AbortVMOnException=InvalidClassException -XX:AbortVMOnExceptionMessage="class invalid for deserialization"
The idea is to add a more generic option OnException that upon the occurrence of a specified exception can run -
(a) generic commands, like:
-XX:OnException=exception=InvalidClassException,message="class invalid for deserialization",cmd="kill -9 %p"
(b) can also accept some pre-defined actions like dumpJfr, dumpCoreAndAbort, dumpCoreAndContinue, dumpHeap, dumpThreads etc.
-XX:OnException=exception=InvalidClassException,message="class invalid for deserialization",action=dumpJfr
This would be very useful in troubleshooting the Java/JVM failures that just result in printing the exception message and stack trace, and where we need more data to investigate the problem.