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

Null CLD while loading shared lambda proxy class with javaagent active

    XMLWordPrintable

Details

    • b08
    • Verified

    Backports

      Description

        When running the following Java program:

        public class Test {
                public static void main(String[] args) throws Exception {
                        new java.text.SimpleDateFormat();
                }
        }

        with the JMC agent (https://github.com/openjdk/jmc/tree/master/agent) on a debug VM, the VM runs into an assertion:

        # Internal Error (/usr/work/d039344/git/github.com/openjdk/jdk/src/hotspot/share/oops/instanceKlass.cpp:394), pid=94447, tid=94448
        # assert(this_key != nullptr) failed: sanity


        The problem seems tp be that the check_shared_class_super_types() in systemDictonary.cpp:1140 returns false, since the
        IntFunction interface of the proxy class resolves to:

        java.util.function.IntFunction {0x00007f29a30bcba8}
         - instance size: 2
         - klass size: 65
         - access: public interface abstract
         - flags: rewritten
         - state: linked
         - name: 'java/util/function/IntFunction'
         - super: 'java/lang/Object'
         - sub:
         - nof implementors: 2
         - arrays: null
         - methods: Array<T>(0x00007f299e64ccc8)
         - method ordering: Array<T>(0x00007f29a2bdbd08)
         - default_methods: Array<T>(0x0000000000000000)
         - local interfaces: Array<T>(0x00007f29a26aae30)
         - trans. interfaces: Array<T>(0x00007f29a26aae30)
         - constants: constant pool [14] {0x00007f299e64cbf0} for 'java/util/function/IntFunction' cache=0x00007f299e64d0b0
         - class loader data: loader data: 0x00007f2a4421b0a0 of 'bootstrap'
         - source file: 'IntFunction.java'
         - class annotations: Array<T>(0x00007f299e64cd88)
         - class type annotations: Array<T>(0x0000000000000000)
         - field annotations: Array<T>(0x0000000000000000)
         - field type annotations: Array<T>(0x0000000000000000)
         - generic signature: '<R:Ljava/lang/Object;>Ljava/lang/Object;'
         - inner classes: Array<T>(0x00007f29a26aadb8)
         - nest members: Array<T>(0x00007f29a26aadb8)
         - permitted subclasses: Array<T>(0x00007f29a26aadb8)
         - java mirror: a 'java/lang/Class'{0x000000011e2537c0} = 'java/util/function/IntFunction'
         - vtable length 5 (start addr: 0x00007f29a30bcd80)
         - itable length 0 (start addr: 0x00007f29a30bcda8)
         - ---- static fields (0 words):
         - ---- non-static fields (0 words):
         - non-static oop maps:
         
        instead of
         
        java.util.function.IntFunction {0x00007f29a217e760}
         - instance size: 2
         - klass size: 65
         - access: public interface abstract
         - flags: rewritten is_shared_boot_class
         - state: allocated
         - name: 'java/util/function/IntFunction'
         - super: 'java/lang/Object'
         - sub:
         - nof implementors: 0
         - arrays: null
         - methods: Array<T>(0x00007f29a28de5b8)
         - method ordering: Array<T>(0x00007f29a28de608)
         - default_methods: Array<T>(0x0000000000000000)
         - local interfaces: Array<T>(0x00007f29a26aae30)
         - trans. interfaces: Array<T>(0x00007f29a26aae30)
         - constants: constant pool [14] {0x00007f29a28de4f8} for 'java/util/function/IntFunction' cache=0x00007f29a217e980
         - source file: 'IntFunction.java'
         - class annotations: Array<T>(0x00007f29a28de4e8)
         - class type annotations: Array<T>(0x0000000000000000)
         - field annotations: Array<T>(0x0000000000000000)
         - field type annotations: Array<T>(0x0000000000000000)
         - generic signature: '<R:Ljava/lang/Object;>Ljava/lang/Object;'
         - inner classes: Array<T>(0x00007f29a26aadb8)
         - nest members: Array<T>(0x00007f29a26aadb8)
         - permitted subclasses: Array<T>(0x00007f29a26aadb8)
         - java mirror: null
         - vtable length 5 (start addr: 0x00007f29a217e938)
         - itable length 0 (start addr: 0x00007f29a217e960)
         - ---- static fields (0 words):
         - ---- non-static fields (0 words):
         - non-static oop maps:


        Here is the lambda class:

        sun.util.locale.provider.LocaleProviderAdapter$$Lambda/0x80000006e {0x00007f29a2387858}
         - instance size: 2
         - klass size: 69
         - access: final synchronized synthetic
         - flags: rewritten should_verify_class is_shared_boot_class has_vanilla_constructor
         - state: allocated
         - name: 'sun/util/locale/provider/LocaleProviderAdapter$$Lambda+0x80000006e'
         - super: 'java/lang/Object'
         - sub:
         - arrays: null
         - methods: Array<T>(0x00007f29a2bdb300)
         - method ordering: Array<T>(0x00007f29a2bdb398)
         - default_methods: Array<T>(0x0000000000000000)
         - local interfaces: Array<T>(0x00007f29a2bdb1f8)
         - trans. interfaces: Array<T>(0x00007f29a2bdb1f8)
         - constants: constant pool [21] {0x00007f29a2bdb208} for 'sun/util/locale/provider/LocaleProviderAdapter$$Lambda+0x80000006e' cache=0x00007f29a2387aa0
         - class annotations: Array<T>(0x0000000000000000)
         - class type annotations: Array<T>(0x0000000000000000)
         - field annotations: Array<T>(0x0000000000000000)
         - field type annotations: Array<T>(0x0000000000000000)
         - inner classes: Array<T>(0x00007f29a26aadb8)
         - nest members: Array<T>(0x00007f29a26aadb8)
         - permitted subclasses: Array<T>(0x00007f29a26aadb8)
         - java mirror: null
         - vtable length 5 (start addr: 0x00007f29a2387a30)
         - itable length 5 (start addr: 0x00007f29a2387a58)
         - ---- static fields (0 words):
         - ---- non-static fields (0 words):
         - non-static oop maps:

        Because of this the class loader data is never set for the proxy in SystemDictionary::load_shared_lambda_proxy_class() and the assertion triggers.

        Best regards,
        Ralf

        Attachments

          Issue Links

            Activity

              People

                ccheung Calvin Cheung
                rschmelter Ralf Schmelter
                Votes:
                0 Vote for this issue
                Watchers:
                8 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved: