RFR: 8308764: Reporting errors from create_vm may crash

Coleen Phillimore coleenp at openjdk.org
Thu Jun 1 15:13:08 UTC 2023


On Wed, 31 May 2023 02:51:03 GMT, David Holmes <dholmes at openjdk.org> wrote:

> There are more details in the bug report but the basic fix is to not delete the main_thread so that it is available to report the exception that caused VM initialization to fail. Added some additional comments too.
> 
> Testing:
>  - basic fault injection to test non-exception exit paths both before and after Universe:;is_fully_initialized() which exercises the failing use of JavaThread::current()
>  -  tiers 1-3 sanity testing
> 
> Thanks.

src/hotspot/share/runtime/threads.cpp line 552:

> 550:   if (status != JNI_OK) {
> 551:     // Don't delete main_thread here as we may need to report exceptions.
> 552:     *canTryAgain = false; // don't let caller call JNI_CreateJavaVM again

So could the jni code try to create a vm, fail and then go on to do other stuff?  Would this then be a memory leak?

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

PR Review Comment: https://git.openjdk.org/jdk/pull/14238#discussion_r1213307916


More information about the hotspot-runtime-dev mailing list