RFR: 8269923: runtime/jni/checked/TestPrimitiveArrayCriticalWithBadParam.java failed with "FATAL ERROR in native method: Primitive type array expected but not received for JNI array operation"
David Holmes
dholmes at openjdk.java.net
Tue Jul 6 23:08:49 UTC 2021
On Tue, 6 Jul 2021 18:52:46 GMT, Zhengyu Gu <zgu at openjdk.org> wrote:
> On Posix compatible platforms, when abort with code dump, it exits with os:abort(), which has exit code 134.
>
> if (dump_core) {
> LINUX_ONLY(if (DumpPrivateMappingsInCore) ClassLoader::close_jrt_image();)
> ::abort(); // dump core
> }
>
>
> but not on Windows, where it still exits with 1.
>
>
> CloseHandle(dumpFile);
> win32::exit_process_or_thread(win32::EPT_PROCESS, 1);
>
>
> The test expects exit code 134 when jni check fails, so it fails on Windows. Maybe we should have Windows also to return 134 for consistence?
>
> The fix changes the check to non-zero exit code.
The fix is good.
The 134 exit code on Posix systems comes from the fact that abort() raises SIGABRT, which is signal number 6 (b0110) . The exit code of the process is set by the OS in the lower 8 bits of the return value: bits 0-6 contains the signal number; bit 7 is set if a core dump occurs. So we have an exit value of b10000110 == decimal 134.
It is debatable whether we should make Windows behave the same for our os::abort.
Thanks,
David
-------------
Marked as reviewed by dholmes (Reviewer).
PR: https://git.openjdk.java.net/jdk/pull/4696
More information about the hotspot-runtime-dev
mailing list