--- old/src/hotspot/share/jfr/recorder/jfrRecorder.cpp 2018-06-22 16:52:24.131137448 -0700 +++ new/src/hotspot/share/jfr/recorder/jfrRecorder.cpp 2018-06-22 16:52:23.782104504 -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)) { --- old/src/hotspot/share/jfr/recorder/service/jfrOptionSet.cpp 2018-06-22 16:52:25.194237789 -0700 +++ new/src/hotspot/share/jfr/recorder/service/jfrOptionSet.cpp 2018-06-22 16:52:24.898209848 -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) { --- old/test/hotspot/jtreg/runtime/appcds/CDSandJFR.java 2018-06-22 16:52:26.087322083 -0700 +++ new/test/hotspot/jtreg/runtime/appcds/CDSandJFR.java 2018-06-22 16:52:25.776292727 -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"); } }