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.
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.
- relates to
-
JDK-8367948 JFR: MethodTrace threshold setting has no effect
-
- New
-
-
JDK-8352738 Implement JEP 520: JFR Method Timing and Tracing
-
- Resolved
-