On Tue, 30 May 2023 08:49:35 GMT, Alan Bateman <[email protected]> wrote:
>> command: make test CONF=fastdebug JTREG="VM_OPTIONS=-Xcomp"
>> TEST=gc/TestAllocHumongousFragment.java
>> error info:
>>
>> Caused by: java.lang.NullPointerException: Cannot invoke
>> "sun.util.locale.BaseLocale.getVariant()" because "base" is null
>> at java.base/java.util.Locale.forLanguageTag(Locale.java:1802)
>> at
>> java.base/sun.util.cldr.CLDRBaseLocaleDataMetaInfo.<clinit>(CLDRBaseLocaleDataMetaInfo.java:41)
>> ... 24 more
>>
>> Note that the test runs with -XX:ShenandoahGCHeuristics=aggressive
>> -XX:+ShenandoahOOMDuringEvacALot and SoftReferences are involved
>> (LocaleObjectCache uses SoftReferences, used by printf method called in
>> getRandomInstance(Utils.java:511)).
>>
>> Maybe we have to deal with the case where the getBaseLocale() return value
>> is null. the call stack is:
>>
>> at
>> java.base/sun.util.locale.LocaleObjectCache.get(LocaleObjectCache.java:64)
>> at java.base/sun.util.locale.BaseLocale.getInstance(BaseLocale.java:169)
>> at
>> java.base/sun.util.locale.InternalLocaleBuilder.getBaseLocale(InternalLocaleBuilder.java:524)
>> at java.base/java.util.Locale.forLanguageTag(Locale.java:1874)
>>
>> in LocaleObjectCache.java:64
>>
>> 62 if (key == null || newVal == null) {
>>
>> 63 // subclass must return non-null key/value object
>>
>> 64 return null; // run here
>> 65 }
>
> I don't think Locale.forLanguageTag is specified to return null so you might
> have to do a bit more analysis to see what this issue is about. There are
> soft refs usages in the locale and it could be that there is some that
> doesn't handle cases where the ref is cleared.
as @AlanBateman said, this patch may not be the radical solution. But once
executed here, the ` return null` should be handled.
62 if (key == null || newVal == null) {
63 // subclass must return non-null key/value object
64 return null; // then what we can do?
65 }
-XX:ShenandoahGCHeuristics=aggressive -XX:+ShenandoahOOMDuringEvacALot can
trigger frequent GC without caring if the memory is really low. So the problem
of soft references can be exposed. I suspect that this code is not executed
under normal circumstances, so there is no exposure problem.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/14211#issuecomment-1568109270