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

Redefining a method that removes use of 1 or more lambda expressions causes the JVM to hang

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P2
    • Resolution: Fixed
    • Affects Version/s: 9, 10
    • Fix Version/s: 11
    • Component/s: hotspot
    • Labels:
      None
    • Subcomponent:
    • Resolved In Build:
      b11

      Description

      Redefinition of a method that originally used 1 or more lambda expressions and after redefinition has removed any lambda expression causes the JVM to hang. See attached test case RedefineSubtractLambdaExpression.java

      The issue is in:

      (gdb) where
      #0 0x00007f310cd0b763 in java_lang_invoke_ResolvedMethodName::vmtarget (resolved_method=...) at src/hotspot/share/classfile/javaClasses.cpp:3250
      #1 0x00007f310d330661 in ResolvedMethodTable::adjust_method_entries (trace_name_printed=trace_name_printed@entry=0x7f2efef0ba10)
          at src/hotspot/share/prims/resolvedMethodTable.cpp:208
      #2 0x00007f310cf1bdc8 in VM_RedefineClasses::doit (this=0x7f2efd0c8ce0) at src/hotspot/share/prims/jvmtiRedefineClasses.cpp:216

      The infinite recursion is due to ResolvedMethodTable::adjust_method_entries() not knowing how to handle a deleted method. In this case the deleted method is one of the private static indy methods resulting from the removed lambda expression.

      Suspicious code in adjust_method_entries:
            oop mem_name = entry->literal();
            Method* old_method = (Method*)java_lang_invoke_ResolvedMethodName::vmtarget(mem_name);

            if (old_method->is_old()) {

              if (old_method->is_deleted()) {
                // leave deleted method in ResolvedMethod for now (this is a bug that we don't mark
                // these on_stack)
                continue;
              }

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                coleenp Coleen Phillimore
                Reporter:
                lfoltan Lois Foltan
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: