RFR: 8308764: Reporting errors from create_vm may crash [v3]

Kim Barrett kbarrett at openjdk.org
Tue Jun 6 01:15:54 UTC 2023


On Mon, 5 Jun 2023 00:23:23 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.
>
> David Holmes has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Apply the same fix to init_globals2()

Changes requested by kbarrett (Reviewer).

src/hotspot/share/prims/jni.cpp line 3638:

> 3636:       // Unclear if we can actually reach here as all error returns should have
> 3637:       // set an exception pending. But it is okay to fall-through to the general
> 3638:       // termination code below.

If it were true that all error returns here had an exception pending then we wouldn't need the conditional
smr_deletes in create_vm.  And if we return without an exception then we'll also not have a current thread
and the JavaThread::current call will return null (or assert in a debug build), leading to failures.  That is,
this change doesn't seem to have addressed the issue described in the bug at all.

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

PR Review: https://git.openjdk.org/jdk/pull/14238#pullrequestreview-1463971285
PR Review Comment: https://git.openjdk.org/jdk/pull/14238#discussion_r1218757916


More information about the hotspot-runtime-dev mailing list