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

A crash in ConstantPool::klass_at_impl

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P4 P4
    • tbd
    • 21.0.5
    • hotspot
    • x86_64
    • linux

      A customer has a reproducible crash and I have a fix which is working for them. Unfortunately so far I do not have a reproducer/testcase. The crash+fix is on jdk21 but I haven't seen any changes in trunk in that code.

      The hs_err backtrace is:

      ConstantPool::klass_at_impl(constantPoolHandle const&, int, JavaThread*)+0x8d
              Handle loader (THREAD, this_cp->pool_holder()->class_loader());
      Reflection::check_for_inner_class(InstanceKlass const*, InstanceKlass const*, bool, JavaThread*)+0x2a0
              outer=ClassName
              inner=ClassName$Inner
              caller: Klass* i = cp->klass_at(ioff, CHECK);
      InstanceKlass::compute_enclosing_class(bool*, JavaThread*) const+0x14a
      JVM_GetDeclaringClass+0x7f

      It crashes at:

      https://github.com/openjdk/jdk21u-dev/blob/04046b185003a99e93905d54964b7018ae892147/src/hotspot/share/oops/constantPool.cpp#L528
      Handle loader (THREAD, this_cp->pool_holder()->class_loader());

      It crashes inside class_loader():

      https://github.com/openjdk/jdk21u-dev/blob/04046b185003a99e93905d54964b7018ae892147/src/hotspot/share/oops/klass.inline.hpp#L68
      inline oop Klass::class_loader() const {
        return class_loader_data()->class_loader();
      And class_loader_data() returns NULL here.

            jkratochvil Jan Kratochvil
            jkratochvil Jan Kratochvil
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated: