changeset 51485:b1b5306fadea

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
author ccheung
date Wed, 27 Jun 2018 14:46:15 -0700
parents 208eff1d03e0
children 4360af3ad94c
files src/hotspot/share/jfr/recorder/jfrRecorder.cpp src/hotspot/share/jfr/recorder/service/jfrOptionSet.cpp test/hotspot/jtreg/runtime/appcds/CDSandJFR.java
diffstat 3 files changed, 11 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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");
     }
 }