Summary
Add dumppath
option to -XX:FlightRecorderOptions
to specify the path for a JFR emergency dump.
Problem
User can specify the dump path for a recording, for example -XX:StartFlightRecording:filename=/recordings/dump.jfr
, which is written when the recording ends.
If the JVM crashes, it can't access the filename path because it's located on the Java heap. To work around this limitation, JFR supports something called an emergency dump that is written to the directory the JVM was started in.
Long term plan is to make native aware of the filename and other specifics needed to make the dump in native behave as it was done from Java. Meanwhile, user may want to specify another directory than the start directory of the JVM process.
Solution
jcmd <pid> JFR.configure
supports the option dumppath=<path>
to set the location of the emergency dump. Currently, the implementation doesn't work, but plan is to correct this when the accompanying enhancement for this CSR is checked in.
Adding a similar option -XX:FlightRecorderOptions:dumppath=<path>
would allow the emergency path to be set on command-line as well. If JFR is not able to write to the directory specified by -XX:FlightRecorderOptions:dumppath=<path>
, the dump will be written to the directory the JVM was started in.
Specification
index 166603d4397..ce8fc5e4efa 100644
--- a/src/hotspot/share/jfr/recorder/service/jfrOptionSet.cpp
+++ b/src/hotspot/share/jfr/recorder/service/jfrOptionSet.cpp
@@ -163,6 +163,7 @@ bool JfrOptionSet::allow_event_retransforms() {
// default options for the dcmd parser
const char* const default_repository = NULL;
+const char* const default_dumppath = NULL;
const char* const default_global_buffer_size = "512k";
const char* const default_num_global_buffers = "20";
const char* const default_memory_size = "10m";
@@ -182,6 +183,13 @@ static DCmdArgument<char*> _dcmd_repository(
false,
default_repository);
+static DCmdArgument<char*> _dcmd_dumppath(
+ "dumppath",
+ "Path to emergency dump",
+ "STRING",
+ false,
+ default_dumppath);
+
static DCmdArgument<MemorySizeArgument> _dcmd_threadbuffersize(
"threadbuffersize",
"Thread buffer size",
@@ -258,6 +266,7 @@ static DCmdParser _parser;
static void register_parser_options() {
_parser.add_dcmd_option(&_dcmd_repository);
+ _parser.add_dcmd_option(&_dcmd_dumppath);
_parser.add_dcmd_option(&_dcmd_threadbuffersize);
_parser.add_dcmd_option(&_dcmd_memorysize);
_parser.add_dcmd_option(&_dcmd_globalbuffersize);
- csr of
-
JDK-8271949 dumppath in -XX:FlightRecorderOptions does not affect
-
- Resolved
-