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:33:48 UTC 2022
On Tue, 20 Dec 2022 10:25:58 GMT, Johan Sjölen <jsjolen 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.
>
> Hi David, the change looks good to me. Is there a particular reason that you chose resource allocation here instead of allocating the buffer on the stack? It should have the same effect.
Thanks for looking at this @jdksjolen .
> Is there a particular reason that you chose resource allocation here instead of allocating the buffer on the stack?
Just a general aversion to putting large buffers on the stack. We've had issues in the past where they've triggered StackOverflowError. Though that really shouldn't be an issue in this case as we have no Java frames on the stack to begin with.
-------------
PR: https://git.openjdk.org/jdk/pull/11703
More information about the hotspot-dev
mailing list