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

JFR: MethodTrace double-counts methods that catch their own exceptions

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P4 P4
    • None
    • 25, 26
    • hotspot
    • None
    • jfr
    • 25

      Implementation of JEP 520 (JDK-8352738) instruments all 'throw' bytecodes in a traced method, treating them as exit points. However, if the method throws an exception which is caught in the same method, this will be erroneously counted as an extra call.

      See attached MethodTraceBugs.java that demonstrates the issue.

      Another side of this issue is that a method call won't be counted when an exception is thrown in some callee of this method, or if it is a JVM implicit exception such as NPE.

      A proper fix would be not to handle 'throw' bytecodes, but instead to amend the method exception table with a catch-all entry, equivalent to "try-finally" statement that wraps the entire method body.

            Unassigned Unassigned
            apangin Andrei Pangin
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: