RFR: 8295974: jni_FatalError and Xcheck:jni warnings should print the native stack when there are no Java frames [v2]
Coleen Phillimore
coleenp at openjdk.org
Thu Dec 22 15:03:51 UTC 2022
On Thu, 22 Dec 2022 08:03:26 GMT, David Holmes <dholmes at openjdk.org> wrote:
>> If a JNI Fatal error, or a JNI warning (from Xcheck:jni) is triggered in "top-level" native code (such as the launcher itself, or a freshly attached native thread) then there is no stack printed as there are no Java frames. This enhancement changes that so that we print the native stack, similarly to how error reporting does. We reuse VMError::print_native _stack to do this, but it could be argued this should be moved to a more general purpose utility class - suggestions welcome.
>>
>> Testing:
>> - manual fault injection (see bug report)
>> - tiers 1-4
>>
>> Thanks.
>
> David Holmes has updated the pull request incrementally with one additional commit since the last revision:
>
> Added a regression test
I have just one request - disabling the core file would make this run better.
test/hotspot/jtreg/runtime/jni/nativeStack/TestNativeStack.java line 32:
> 30: * the native stack is present as expected.
> 31: * @comment The native code only supports POSIX so no windows testing
> 32: * @driver TestNativeStack
Can you make this test not dump a core file?
test/hotspot/jtreg/runtime/jni/nativeStack/TestNativeStack.java line 65:
> 63: "TestNativeStack$Main",
> 64: "error");
> 65: oa.reportDiagnosticSummary();
So this just prints out the stack trace but doesn't do a shouldContain or some verification of the elements? I presume because this would be unreliable? This seems ok, but just checking. I think it's still worth having a regression test because this looked hard to write and if the stack in the messages do disappear, it'll save someone from having to rewrite this.
-------------
PR: https://git.openjdk.org/jdk/pull/11703
More information about the hotspot-dev
mailing list