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

libgraal can deadlock in -Xcomp mode

XMLWordPrintable

    • b08

        JDK-8248168 (https://hg.openjdk.java.net/jdk/jdk/rev/561a1d66a4fd) fixed a regression that caused jargraal to deadlock in certain conditions when running with -Xcomp. Unfortunately, the fix allowed the same deadlock to still occur when using libgraal. Here's an example of such a deadlock:

        "main" #1 prio=5 os_prio=31 cpu=325.55ms elapsed=199.38s tid=0x00007ffa65808a00 nid=0x1903 waiting on condition [0x0000700003c45000]
           java.lang.Thread.State: RUNNABLE
        at java.lang.StringUTF16.compress(java.base@16-internal/StringUTF16.java:179)
        at java.lang.StringUTF16.compress(java.base@16-internal/StringUTF16.java:162)
        at java.lang.String.<init>(java.base@16-internal/String.java:3628)
        at java.lang.String.<init>(java.base@16-internal/String.java:269)
        at jdk.internal.jimage.ImageStringsReader.stringFromByteBuffer(java.base@16-internal/ImageStringsReader.java:250)
        at jdk.internal.jimage.BasicImageReader.getString(java.base@16-internal/BasicImageReader.java:334)
        at jdk.internal.jimage.ImageStringsReader.get(java.base@16-internal/ImageStringsReader.java:51)
        at jdk.internal.jimage.ImageLocation.verify(java.base@16-internal/ImageLocation.java:158)
        at jdk.internal.jimage.BasicImageReader.findLocation(java.base@16-internal/BasicImageReader.java:273)
        - locked <0x0000000127847bf0> (a jdk.internal.jimage.ImageReader$SharedImageReader)
        at jdk.internal.jimage.ImageReader.findLocation(java.base@16-internal/ImageReader.java:148)
        at jdk.internal.module.SystemModuleFinders$SystemModuleReader.findImageLocation(java.base@16-internal/SystemModuleFinders.java:428)
        at jdk.internal.module.SystemModuleFinders$SystemModuleReader.find(java.base@16-internal/SystemModuleFinders.java:437)
        at jdk.internal.loader.BuiltinClassLoader$2.run(java.base@16-internal/BuiltinClassLoader.java:432)
        at jdk.internal.loader.BuiltinClassLoader$2.run(java.base@16-internal/BuiltinClassLoader.java:427)
        at java.security.AccessController.executePrivileged(java.base@16-internal/AccessController.java:784)
        at java.security.AccessController.doPrivileged(java.base@16-internal/AccessController.java:554)
        at jdk.internal.loader.BuiltinClassLoader.findMiscResource(java.base@16-internal/BuiltinClassLoader.java:426)
        at jdk.internal.loader.BuiltinClassLoader.findResource(java.base@16-internal/BuiltinClassLoader.java:310)
        at jdk.internal.loader.BootLoader.findResource(java.base@16-internal/BootLoader.java:180)
        at java.lang.ClassLoader.getResource(java.base@16-internal/ClassLoader.java:1407)
        at java.lang.ClassLoader.getResource(java.base@16-internal/ClassLoader.java:1405)
        at org.dacapo.harness.Benchmark.getURL(Benchmark.java:544)
        at org.dacapo.harness.Benchmark.extractFileResource(Benchmark.java:596)
        at org.dacapo.harness.Benchmark.prepareJars(Benchmark.java:229)
        at org.dacapo.harness.Benchmark.initialize(Benchmark.java:211)
        at org.dacapo.harness.Benchmark.<init>(Benchmark.java:184)
        at org.dacapo.harness.Benchmark.<init>(Benchmark.java:194)
        at org.dacapo.harness.Pmd.<init>(Pmd.java:31)
        at jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(java.base@16-internal/Native Method)
        at jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(java.base@16-internal/NativeConstructorAccessorImpl.java:64)
        at jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(java.base@16-internal/DelegatingConstructorAccessorImpl.java:45)
        at java.lang.reflect.Constructor.newInstanceWithCaller(java.base@16-internal/Constructor.java:500)
        at java.lang.reflect.Constructor.newInstance(java.base@16-internal/Constructor.java:481)
        at org.dacapo.harness.TestHarness.runBenchmark(TestHarness.java:211)
        at org.dacapo.harness.TestHarness.main(TestHarness.java:171)
        at Harness.main(Harness.java:17)


        "JVMCI-native CompilerThread2" #13 daemon prio=9 os_prio=35 cpu=41.27ms elapsed=199.11s tid=0x00007ffa7580c000 nid=0x6503 waiting for monitor entry [0x0000700004e71000]
           java.lang.Thread.State: BLOCKED (on object monitor)
           Compiling: 312 b 4 java.lang.StringUTF16::compress (50 bytes)
        at jdk.internal.jimage.BasicImageReader.findLocation(java.base@16-internal/BasicImageReader.java:253)
        - waiting to lock <0x0000000127847bf0> (a jdk.internal.jimage.ImageReader$SharedImageReader)
        at jdk.internal.jimage.ImageReader.findLocation(java.base@16-internal/ImageReader.java:148)
        at jdk.internal.module.SystemModuleFinders$SystemModuleReader.findImageLocation(java.base@16-internal/SystemModuleFinders.java:428)
        at jdk.internal.module.SystemModuleFinders$SystemModuleReader.read(java.base@16-internal/SystemModuleFinders.java:464)
        at jdk.internal.loader.BuiltinClassLoader.defineClass(java.base@16-internal/BuiltinClassLoader.java:772)
        at jdk.internal.loader.BuiltinClassLoader.findClassInModuleOrNull(java.base@16-internal/BuiltinClassLoader.java:705)
        at jdk.internal.loader.BuiltinClassLoader.loadClassOrNull(java.base@16-internal/BuiltinClassLoader.java:630)
        - locked <0x000000012a1c0e60> (a java.lang.Object)
        at jdk.internal.loader.BuiltinClassLoader.loadClassOrNull(java.base@16-internal/BuiltinClassLoader.java:665)
        at jdk.internal.loader.BuiltinClassLoader.loadClassOrNull(java.base@16-internal/BuiltinClassLoader.java:634)
        - locked <0x000000012a1c0dc0> (a java.lang.Object)
        at jdk.internal.loader.BuiltinClassLoader.loadClass(java.base@16-internal/BuiltinClassLoader.java:604)
        at jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(java.base@16-internal/ClassLoaders.java:168)
        at java.lang.ClassLoader.loadClass(java.base@16-internal/ClassLoader.java:522)

        The main thread above is blocked while waiting to be compiled by libgraal. It assumes that libgraal cannot trigger class loading. Ideally, that should be true but we're not quite there yet as can be seen by the stack for the "JVMCI-native CompilerThread2".

              dnsimon Douglas Simon
              dnsimon Douglas Simon
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

                Created:
                Updated:
                Resolved: