Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8289220

Locale.forLanguageTag throws NPE due to soft ref used in locale cache being cleared

    XMLWordPrintable

Details

    Description

      We have seen intermittent TestAllocObjectArrays.java#aggressive failures on x86_64, aarch64 and PPC64le since JDK 19. (Also TestAllocIntArrays.java#iu-aggressive and TestAllocIntArrays.java#aggressive.)

      jtr file tells us the following:

      command: main -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=aggressive -XX:+ShenandoahOOMDuringEvacALot -XX:+ShenandoahVerify TestAllocObjectArrays
      reason: User specified action: run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xmx1g -Xms1g -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=aggressive -XX:+ShenandoahOOMDuringEvacALot -XX:+ShenandoahVerify TestAllocObjectArrays
      Mode: othervm [/othervm specified]
      elapsed time (seconds): 3.295
      ----------configuration:(0/0)----------
      ----------System.out:(1/34)----------
      For random generator using seed:
      ----------System.err:(34/2342)----------
      java.lang.ExceptionInInitializerError
      at java.base/sun.util.cldr.CLDRLocaleProviderAdapter.<clinit>(CLDRLocaleProviderAdapter.java:60)
      at java.base/java.lang.Class.forName0(Native Method)
      at java.base/java.lang.Class.forName(Class.java:383)
      at java.base/java.lang.Class.forName(Class.java:376)
      at java.base/sun.util.locale.provider.LocaleProviderAdapter.forType(LocaleProviderAdapter.java:187)
      at java.base/sun.util.locale.provider.LocaleProviderAdapter.findAdapter(LocaleProviderAdapter.java:287)
      at java.base/sun.util.locale.provider.LocaleProviderAdapter.getAdapter(LocaleProviderAdapter.java:258)
      at java.base/java.text.DecimalFormatSymbols.getInstance(DecimalFormatSymbols.java:181)
      at java.base/java.util.Formatter.getDecimalFormatSymbols(Formatter.java:2021)
      at java.base/java.util.Formatter.getZero(Formatter.java:2029)
      at java.base/java.util.Formatter$FormatSpecifier.localizedMagnitude(Formatter.java:4526)
      at java.base/java.util.Formatter$FormatSpecifier.print(Formatter.java:3366)
      at java.base/java.util.Formatter$FormatSpecifier.printInteger(Formatter.java:3051)
      at java.base/java.util.Formatter$FormatSpecifier.print(Formatter.java:3010)
      at java.base/java.util.Formatter.format(Formatter.java:2781)
      at java.base/java.io.PrintStream.implFormat(PrintStream.java:1366)
      at java.base/java.io.PrintStream.format(PrintStream.java:1345)
      at java.base/java.io.PrintStream.printf(PrintStream.java:1244)
      at jdk.test.lib.Utils.getRandomInstance(Utils.java:511)
      at TestAllocObjectArrays.main(TestAllocObjectArrays.java:202)
      at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
      at java.base/java.lang.reflect.Method.invoke(Method.java:578)
      at com.sun.javatest.regtest.agent.MainWrapper$MainThread.run(MainWrapper.java:127)
      at java.base/java.lang.Thread.run(Thread.java:1596)
      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)).

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              mdoerr Martin Doerr
              Votes:
              0 Vote for this issue
              Watchers:
              8 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: