Uploaded image for project: 'Java Mission Control'
  1. Java Mission Control
  2. JMC-6532

Instrumentation fails for methods containing try-catch clauses

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 7.1.0
    • 7.1.0
    • Mission Control Core
    • None
    • JMC 7.1 Sprint 6

      (Originally reported by Arvin Xu)

       

      Problem: try-catch clauses are compiled into compressed frames, while
      JFR(Next)MethodAdvisor, extending from LocalVariablesSorter, only
      accepts expanded frames. See the call stack attached.

      Steps to reproduce:
      1. replace org.openjdk.jmc.agent.test.InstrumentMe::printHelloWorldJFR1 with:

      public static

      void printHelloWorldJFR1() throws InterruptedException {
          try {
              System.out.println("#SJFR1. Hello World!"); //$NON-NLS-1$
              Thread.sleep(1000);
          } catch (Exception e) {         
              // intentionally empty
          }
      }

      2. run `mvn clean package verify`

      SEVERE: Failed to instrument printHelloWorldJFR1()V
      java.lang.IllegalArgumentException: LocalVariablesSorter only accepts
      expanded frames (see ClassReader.EXPAND_FRAMES)
              at org.objectweb.asm.commons.LocalVariablesSorter.visitFrame(LocalVariablesSorter.java:188)
              at org.objectweb.asm.ClassReader.readCode(ClassReader.java:1841)
              at org.objectweb.asm.ClassReader.readMethod(ClassReader.java:1283)
              at org.objectweb.asm.ClassReader.accept(ClassReader.java:688)
              at org.objectweb.asm.ClassReader.accept(ClassReader.java:400)
              at org.openjdk.jmc.agent.Transformer.doJFRLogging(Transformer.java:101)
              at org.openjdk.jmc.agent.Transformer.doTransform(Transformer.java:84)
              at org.openjdk.jmc.agent.Transformer.doTransforms(Transformer.java:74)
              at org.openjdk.jmc.agent.Transformer.transform(Transformer.java:65)
              at org.openjdk.jmc.agent.test.TestJFRTransformer.testRunTransforms(TestJFRTransformer.java:69)
      ...[irrelevant lines omitted]..

            aptmac Alex Macdonald
            aptmac Alex Macdonald
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: