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

JfrJvmtiAgent::retransformClasses failed: JVMTI_ERROR_FAILS_VERIFICATION

XMLWordPrintable

    • jfr
    • b22
    • generic
    • generic

      ADDITIONAL SYSTEM INFORMATION :
      Windows 11, Ubuntu 22.94
      Fails with:
      build 22-ea+14-1033
      build 21+35-2513
      Works with:
      openjdk version "17.0.8" 2023-07-18 LTS
      OpenJDK Runtime Environment Zulu17.44+15-CA (build 17.0.8+7-LTS)
      OpenJDK 64-Bit Server VM Zulu17.44+15-CA (build 17.0.8+7-LTS, mixed mode, sharing)

      A DESCRIPTION OF THE PROBLEM :
      When starting JFR in a running JVM with -Xverify:all, retransformation fails under certain circumstances with a verification error. In the attached sample, both the sleep and the configuration loading are required.

      We have first discovered a JVMTI_ERROR_FAILS_VERIFICATION in a situation where JFR is initialized at start up together with a JVMTI agent, but this variant is not easily reproducible.

      REGRESSION : Last worked in version 17.0.8

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      With JAVA_HOME set to a JDK 21 or 22, start

      $JAVA_HOME/bin/java -Xverify:all JfrVerify.java

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Process returns with 0.
      ACTUAL -
      Terminates with

      Exception in thread "main" java.lang.RuntimeException: JfrJvmtiAgent::retransformClasses failed: JVMTI_ERROR_FAILS_VERIFICATION
              at jdk.jfr/jdk.jfr.internal.JVM.retransformClasses(Native Method)
              at jdk.jfr/jdk.jfr.internal.SettingsManager.updateRetransform(SettingsManager.java:172)
              at jdk.jfr/jdk.jfr.internal.SettingsManager.setSettings(SettingsManager.java:152)
              at jdk.jfr/jdk.jfr.internal.MetadataRepository.setSettings(MetadataRepository.java:220)
              at jdk.jfr/jdk.jfr.internal.PlatformRecorder.updateSettingsButIgnoreRecording(PlatformRecorder.java:395)
              at jdk.jfr/jdk.jfr.internal.PlatformRecorder.updateSettings(PlatformRecorder.java:384)
              at jdk.jfr/jdk.jfr.internal.PlatformRecorder.start(PlatformRecorder.java:254)
              at jdk.jfr/jdk.jfr.internal.PlatformRecording.start(PlatformRecording.java:125)
              at jdk.jfr/jdk.jfr.Recording.start(Recording.java:177)
              at JfrVerify.main(JfrVerify.java:12)

      ---------- BEGIN SOURCE ----------
      --- JfrVerify.java -----------------------------------------------------------------
      import jdk.jfr.Configuration;
      import jdk.jfr.Recording;
      import java.nio.file.Path;

      public class JfrVerify {
          public static void main(String... args) throws Exception {
              Thread.sleep(10_000); // does not happen without the sleep
              System.err.println("STARTING JFR");
      // does not happen without loading a configuration
              try (var recording = new Recording(Configuration.getConfiguration("default"))) {
                  recording.setDestination(Path.of("test.jfr"));
                  recording.start();
                  Thread.sleep(5_000);
                  recording.stop();
              }
          }
      }
      --------------------------------------------------------------------------------------
      ---------- END SOURCE ----------

      FREQUENCY : always


            mgronlun Markus Grönlund
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: