RFR: 8295974: jni_FatalError and Xcheck:jni warnings should print the native stack when there are no Java frames
David Holmes
dholmes at openjdk.org
Wed Dec 21 03:43:51 UTC 2022
On Tue, 20 Dec 2022 23:04:34 GMT, Coleen Phillimore <coleenp 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.
>
> This looks like a nice improvement. Do you have a test for it, or do the existing Xcheck:jni tests exercise this? I'd prefer JavaThread::print_jni_stack() moved to VMError rather than VMError::print_native_stack moved to JavaThread.
Thanks for looking at this @coleenp .
> Do you have a test for it, or do the existing Xcheck:jni tests exercise this?
No regression tests for this, I tested by manually adjusting the launcher code to force an error and an existing test to force a warning. I could look at creating a regression test though.
> I'd prefer JavaThread::print_jni_stack() moved to VMError rather than VMError::print_native_stack moved to JavaThread.
Well I wasn't suggesting moving `print_native_stack` into `JavaThread`, but the current usage isn't related to `VMError` so it could be moved somewhere more general, or I can just leave it.
-------------
PR: https://git.openjdk.org/jdk/pull/11703
More information about the hotspot-dev
mailing list