RFR: 8344165: Trace exceptions with a complete call-stack [v8]

Ioi Lam iklam at openjdk.org
Fri Jun 20 17:30:29 UTC 2025


On Fri, 20 Jun 2025 13:32:46 GMT, Coleen Phillimore <coleenp at openjdk.org> wrote:

>> 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
>
> src/hotspot/share/utilities/exceptions.cpp line 619:
> 
>> 617: // We don't want to use an OopHandle, or else we may prevent this object from being collected.
>> 618: // Whenever a GC happens, this will be cleared by Exceptions::clear_logging_cache().
>> 619: static oop _last_logged_exception;
> 
> oh gosh I don't like this at all.  Save the exception string if anything.

I've got rid of the caching completely. Now the stack trace is printed only at sites that are actually doing a "throw".

We still have some extraneous stack traces that are printed at the exit of a `finally` block. So if you have code that looks like this:


try (A a = new A()) {
  try (B b = new B()) {
    try (C c = new C()) {
        ((Object)(null)).toString();
    }
  }
}


You will see the stacktrace 4 times. But I think that's acceptable for now. I added a suggestion for fixing that in comments.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/25522#discussion_r2159421444


More information about the hotspot-dev mailing list