[jdk25u-dev] RFR: 8367949: JFR: MethodTrace double-counts methods that catch their own exceptions

Roland Mesde duke at openjdk.org
Mon Jan 26 20:45:45 UTC 2026


Backporting JDK-8367949: JFR: MethodTrace double-counts methods that catch their own exceptions.

This PR fixes a bug in JEP 520's method tracing instrumentation. The current implementation incorrectly instruments throw bytecodes as method exits, causing:

1. Overcounting: Exceptions caught within the same method are wrongly counted as extra calls
2. Undercounting: Method calls aren't counted when exceptions are thrown by callees or when JVM implicit exceptions (like NPE) occur

This backport has customer demand.

Ran related tests on linux-x64, linux-aarch64, macos-aarch64 and windows-x64:

make test TEST=jdk_jfr

Results attached:

[linux-aarch64-specific-test.log](https://github.com/user-attachments/files/24868017/linux-aarch64-specific-test.log)
[linux-x64-specific-test.log](https://github.com/user-attachments/files/24868018/linux-x64-specific-test.log)
[macos-aarch64-specific-test.log](https://github.com/user-attachments/files/24868019/macos-aarch64-specific-test.log)
[windows-x64-specific-test.log](https://github.com/user-attachments/files/24868020/windows-x64-specific-test.log)

-------------

Commit messages:
 - Backport fa2eb626478806dc64fe03d8729f53f7ed26a172

Changes: https://git.openjdk.org/jdk25u-dev/pull/182/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk25u-dev&pr=182&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8367949
  Stats: 363 lines in 5 files changed: 333 ins; 1 del; 29 mod
  Patch: https://git.openjdk.org/jdk25u-dev/pull/182.diff
  Fetch: git fetch https://git.openjdk.org/jdk25u-dev.git pull/182/head:pull/182

PR: https://git.openjdk.org/jdk25u-dev/pull/182


More information about the jdk-updates-dev mailing list