Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8145036

Add OnException diagnostic JVM option

    Details

    • Type: Enhancement
    • Status: Closed
    • Priority: P3
    • Resolution: Won't Fix
    • Affects Version/s: 9
    • Fix Version/s: 10
    • Component/s: hotspot

      Description

      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.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              poonam Poonam Bajaj Parhar
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: