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

David Holmes dholmes at openjdk.org
Tue Jun 6 02:58:56 UTC 2023


On Tue, 6 Jun 2023 01:13:08 GMT, Kim Barrett <kbarrett at openjdk.org> wrote:

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

I think you are right - I tried to make too many changes. The original code just didn't delete the main-thread - nice and simple but "leaks". With Coleen's suggested change we only keep the main thread if there is an exception pending, but that then opens up the possibility that we reach this section of code with no current thread again.

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

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


More information about the hotspot-runtime-dev mailing list