RFR: 8344165: Trace exceptions with a complete call-stack [v8]
David Holmes
dholmes at openjdk.org
Tue Jun 17 05:36:31 UTC 2025
On Tue, 10 Jun 2025 18:34:00 GMT, Ioi Lam <iklam at openjdk.org> wrote:
>> This PR makes it easier to analyze exceptions without modifying the JVM or the app to print call stacks:
>>
>> Excerpt from the test case ExceptionsTest.java.
>>
>>
>> [0.038s][info][exceptions ] Exception <a 'java/lang/RuntimeException'{0x0000000474019bd8}: Test exception 2 for logging>
>> [ ] thrown in interpreter method <{method} {0x000074c408400810} 'baz2' '()V' in 'ExceptionsTest$InternalClass'>
>> [ ] at bci 9 for thread 0x000074c46402c7b0 (main)
>> [0.038s][info][exceptions,stacktrace] at ExceptionsTest$InternalClass.baz2(ExceptionsTest.java:142)
>> [0.038s][info][exceptions,stacktrace] at ExceptionsTest$InternalClass.bar2(ExceptionsTest.java:135)
>> [0.038s][info][exceptions,stacktrace] at ExceptionsTest$InternalClass.foo2(ExceptionsTest.java:127)
>> [0.038s][info][exceptions,stacktrace] at ExceptionsTest$InternalClass.main(ExceptionsTest.java:110)
>> [0.038s][info][exceptions ] Exception <a 'java/lang/RuntimeException'{0x0000000474019bd8}: Test exception 2 for logging>
>> [ ] thrown in interpreter method <{method} {0x000074c408400748} 'bar2' '()V' in 'ExceptionsTest$InternalClass'>
>> [ ] at bci 0 for thread 0x000074c46402c7b0 (main)
>> [0.038s][info][exceptions ] Found matching handler for exception of type "java.lang.RuntimeException" in method "bar2" at BCI: 6
>> [0.038s][info][exceptions ] Exception <a 'java/lang/RuntimeException'{0x0000000474019bd8}: Test exception 2 for logging>
>> [ ] thrown in interpreter method <{method} {0x000074c408400748} 'bar2' '()V' in 'ExceptionsTest$InternalClass'>
>> [ ] at bci 8 for thread 0x000074c46402c7b0 (main)
>> [0.038s][info][exceptions,stacktrace] at ExceptionsTest$InternalClass.bar2(ExceptionsTest.java:137)
>> [0.038s][info][exceptions,stacktrace] at ExceptionsTest$InternalClass.foo2(ExceptionsTest.java:127)
>> [0.038s][info][exceptions,stacktrace] at ExceptionsTest$InternalClass.main(ExceptionsTest.java:110)
>> [0.038s][info][exceptions ] Exception <a 'java/lang/RuntimeException'{0x0000000474019bd8}: Test exception 2 for logging>
>> [ ] thrown in interpreter method <{method} {0x000074c408400670} 'foo2' '()V' in 'ExceptionsTest$InternalClass'>
>> [ ] at bci 0 for thread 0x000074c46402c7b0 (m...
>
> Ioi Lam has updated the pull request incrementally with one additional commit since the last revision:
>
> @dholmes-ora comments -- removed printing of output.getStdout() from test
I think this is looking "good enough" - just one query on clearing the cache below.
Thanks
src/hotspot/share/gc/serial/serialHeap.cpp line 549:
> 547:
> 548: // Whenever a GC happens, clear the exception logging cache to avoid stale oop pointers.
> 549: Exceptions::clear_logging_cache();
Shouldn't we do this prior to the GC to be extra-safe?
-------------
Marked as reviewed by dholmes (Reviewer).
PR Review: https://git.openjdk.org/jdk/pull/25522#pullrequestreview-2934183757
PR Review Comment: https://git.openjdk.org/jdk/pull/25522#discussion_r2151353311
More information about the hotspot-dev
mailing list