RFR: 8309034: NoClassDefFoundError when initializing Long$LongCache

David Holmes dholmes at openjdk.org
Tue Jun 13 21:36:21 UTC 2023


On Tue, 13 Jun 2023 21:20:23 GMT, David Holmes <dholmes at openjdk.org> wrote:

>> src/hotspot/share/oops/instanceKlass.cpp line 1002:
>> 
>>> 1000:     } else {
>>> 1001:       return;
>>> 1002:     }
>> 
>> If the original exception was OOM or SOE, maybe we should skip the call to create_initialization_error?  Or in that function should return the pre allocated exceptions unconditionally?  It seems like we could avoid code that tries to allocate at an unstable state in the vm since we're explicitly testing for these conditions now.
>> I think I'd rather see this code moved to create_initialization_error even though it doesn't create it for these.
>
> Thanks for looking at this Coleen.
> 
> An OOME during initialization does not necessarily imply an unstable state in the VM as it may not relate to the Java heap. So I think it is better to try to do the right thing and only use the shared instances as a fall-back when things go wrong.
> 
> I actually started with the code in `create_initialization_error` but decided it was the wrong place to decide what to do if that fails. I think the policy belongs in instanceKlass.

Even SOE doesn't need to imply instability - the static initializer may have done something to trigger SOE but that unwinds and so there is plenty of stack to create the EIIE.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/14438#discussion_r1228718575


More information about the hotspot-runtime-dev mailing list