8203664: JFR start failure after AppCDS archive created with JFR StartFlightRecording
authorccheung
Wed, 27 Jun 2018 14:46:15 -0700
changeset 50851 b1b5306fadea
parent 50850 208eff1d03e0
child 50852 4360af3ad94c
8203664: JFR start failure after AppCDS archive created with JFR StartFlightRecording Summary: disable JFR and output a warning message during CDS dump time if JFR is enabled. Reviewed-by: jiangli, lfoltan
src/hotspot/share/jfr/recorder/jfrRecorder.cpp
src/hotspot/share/jfr/recorder/service/jfrOptionSet.cpp
test/hotspot/jtreg/runtime/appcds/CDSandJFR.java
--- a/src/hotspot/share/jfr/recorder/jfrRecorder.cpp	Wed Jun 27 14:20:41 2018 -0700
+++ b/src/hotspot/share/jfr/recorder/jfrRecorder.cpp	Wed Jun 27 14:46:15 2018 -0700
@@ -181,6 +181,11 @@
 }
 
 bool JfrRecorder::on_vm_start() {
+  if (DumpSharedSpaces && (JfrOptionSet::startup_recordings() != NULL)) {
+    warning("JFR will be disabled during CDS dumping");
+    teardown_startup_support();
+    return true;
+  }
   const bool in_graph = JfrJavaSupport::is_jdk_jfr_module_available();
   Thread* const thread = Thread::current();
   if (!JfrOptionSet::initialize(thread)) {
--- a/src/hotspot/share/jfr/recorder/service/jfrOptionSet.cpp	Wed Jun 27 14:20:41 2018 -0700
+++ b/src/hotspot/share/jfr/recorder/service/jfrOptionSet.cpp	Wed Jun 27 14:46:15 2018 -0700
@@ -707,7 +707,7 @@
     }
   }
   delete startup_recording_array;
-  DEBUG_ONLY(startup_recording_array = NULL;)
+  startup_recording_array = NULL;
 }
 
 bool JfrOptionSet::parse_flight_recorder_option(const JavaVMOption** option, char* tail) {
--- a/test/hotspot/jtreg/runtime/appcds/CDSandJFR.java	Wed Jun 27 14:20:41 2018 -0700
+++ b/test/hotspot/jtreg/runtime/appcds/CDSandJFR.java	Wed Jun 27 14:46:15 2018 -0700
@@ -74,5 +74,10 @@
         TestCommon.checkExec(TestCommon.exec(appJar,
                                              "-XX:FlightRecorderOptions=retransform=false",
                                              "GetFlightRecorder"));
+
+        // Test dumping with flight recorder enabled.
+        output = TestCommon.testDump(appJar, TestCommon.list(classes),
+                                     "-XX:StartFlightRecording=dumponexit=true");
+        TestCommon.checkDump(output, "warning: JFR will be disabled during CDS dumping");
     }
 }