JDK-8225694 : Destination option missing in FlightRecorderMXBeanImpl
  • Type: Bug
  • Component: hotspot
  • Sub-Component: jfr
  • Affected Version: 11,13
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2019-06-12
  • Updated: 2020-06-01
  • Resolved: 2019-10-07
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 11 JDK 13 JDK 14
11.0.6Fixed 13.0.4Fixed 14 b18Fixed
Description
A DESCRIPTION OF THE PROBLEM :
According to official documentation of FlightRecorderMXBeanImpl, there should be a valid recording option availabe - destination, which specifies the path where recording data is written when the recording stops. However, such an option is not supported in the source code and using this options ends with following exception: IllegalArgumentException("Unknown recording option: destination. Valid options are maxSize, maxAge, name, disk, dumpOnExit, duration)

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. create flightRecorderMXBean instance
2. long recordingId = flightRecorderMXBean.newRecording();
3. flightRecorderMXBean.setRecordingOptions(recordingId, getPredefinedRecordingOptions());
4. flightRecorderMXBean.setPredefinedConfiguration(recordingId, "profile");
5. flightRecorderMXBean.startRecording(recordingId);

This is what getPredefinedRecordingOptions() returns:
private Map<String, String> getPredefinedRecordingOptions()
    {
        return new HashMap<>()
        {{
            put("name", "recording");
            put("maxAge", "10 m");
            put("maxSize", Long.toString(1024 * 1024 * 1024));
            put("dumpOnExit", "true");
            put("disk", "true");
            put("duration", "3 m");
            put("destination", "/recordings/recording.jfr");
        }};
    }


EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Recording successfully starts
ACTUAL -
Following exception is thrown:
IllegalArgumentException("Unknown recording option: destination. Valid options are maxSize, maxAge, name, disk, dumpOnExit, duration)

CUSTOMER SUBMITTED WORKAROUND :
Use copyTo method in FlightRecorderMXBeanImpl to achieve storing into desired directory and file.

FREQUENCY : always



Comments
Fix request (13u): The change applies cleanly, tested with the modified test, and tier1.
28-05-2020

[~clanger] Thanks for the offer, I'll sponsor this for Jie.
23-10-2019

[~jkang], Shall I sponsor this for you?
19-10-2019

Fix Request (11u) This adds an option that should be available according to documentation. The patch applies cleanly to jdk-updates/jdk11u-dev. Tier one tests and the updated test passed for me.
17-10-2019

URL: https://hg.openjdk.java.net/jdk/jdk/rev/8ca46e186a63 User: egahlin Date: 2019-10-07 14:47:32 +0000
07-10-2019

Reassigning to Chihiro since he has already started working on a fix.
01-10-2019

ILW = MHM = P3
18-06-2019

This is clearly an issue. According to JDK11 javadoc https://docs.oracle.com/en/java/javase/11/docs/api/jdk.management.jfr/jdk/management/jfr/FlightRecorderMXBean.html There are list of recording options (name, maxAge, maxSize, dumpOnExit, destination, duration and disk) But source of FlightRecorderMXBeanImpl.java doesn't contain "destination" as recording option jdk-jdk/open/src/jdk.management.jfr/share/classes/jdk/management/jfr/FlightRecorderMXBeanImpl.java >private static final List<String> OPTIONS = Arrays.asList(new String[] { OPTION_DUMP_ON_EXIT, OPTION_DURATION, OPTION_NAME, OPTION_MAX_AGE, OPTION_MAX_SIZE, OPTION_DISK, });
13-06-2019