Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8225312

Deprecate -XX:FlightRecorder Option

    Details

    • Type: CSR
    • Status: Closed
    • Priority: P4
    • Resolution: Approved
    • Fix Version/s: 13
    • Component/s: hotspot
    • Labels:
      None
    • Subcomponent:
      jfr
    • Compatibility Kind:
      behavioral
    • Compatibility Risk:
      minimal
    • Compatibility Risk Description:
      Deprecate a flag that is no longer needed.
    • Interface Kind:
      add/remove/modify command line option
    • Scope:
      JDK

      Description

      Summary

      Deprecate -XX:FlightRecorder option as it is no longer needed.

      Problem

      Before JDK 8u40, HotSpot needed to allocate JFR thread buffers when a thread was created.

      To ensure that recordings could be started on an already running JVM, using JMX or jcmd, the option -XX:FlightRecorder was added. If set to true, every new thread would get a 5 KB buffer, regardless if a recording was started or not.

      In JDK 8u40 that restriction was lifted and a thread buffer could be added to an already running thread. That effectively made -XX:+FlightRecorder a no-op.

      Even though the flag has been useless for 4.5 years, it is still widely used and gives the impression that it is more complicated to use JFR than it really is.

      Solution

      Deprecate the flag.

      It should be noted that -XX:-FlightRecorder could be used to prevent a user from starting JFR and make the jdk.jfr.FlightRecorder::isAvailable() method return false. This would still be the case after deprecation, but if the flag were to be removed later, it would change the behaviour of that method, which is probably OK.

      Specification

      diff --git a/src/hotspot/share/runtime/arguments.cpp b/src/hotspot/share/runtime/arguments.cpp
      --- a/src/hotspot/share/runtime/arguments.cpp
      +++ b/src/hotspot/share/runtime/arguments.cpp
      @@ -537,7 +537,8 @@
         { "AllowJNIEnvProxy",             JDK_Version::jdk(13), JDK_Version::jdk(14), JDK_Version::jdk(15) },
         { "ThreadLocalHandshakes",        JDK_Version::jdk(13), JDK_Version::jdk(14), JDK_Version::jdk(15) },
         { "AllowRedefinitionToAddDeleteMethods", JDK_Version::jdk(13), JDK_Version::undefined(), JDK_Version::undefined() },
      -
      +  { "FlightRecorder",               JDK_Version::jdk(13), JDK_Version::undefined(), JDK_Version::undefined() },
      +
         // --- Deprecated alias flags (see also aliased_jvm_flags) - sorted by obsolete_in then expired_in:
         { "DefaultMaxRAMFraction",        JDK_Version::jdk(8),  JDK_Version::undefined(), JDK_Version::undefined() },
         { "CreateMinidumpOnCrash",        JDK_Version::jdk(9),  JDK_Version::undefined(), JDK_Version::undefined() },
      diff --git a/src/hotspot/share/runtime/globals.hpp b/src/hotspot/share/runtime/globals.hpp
      --- a/src/hotspot/share/runtime/globals.hpp
      +++ b/src/hotspot/share/runtime/globals.hpp
      
      @@ -2549,7 +2550,7 @@
                 "leverage profiling for table/lookup switch")                     \
                                                                                   \
         JFR_ONLY(product(bool, FlightRecorder, false,                             \
      -          "Enable Flight Recorder"))                                        \
      +          "(Deprecated) Enable Flight Recorder"))                                        \
                                                                                   \
         JFR_ONLY(product(ccstr, FlightRecorderOptions, NULL,                      \
                 "Flight Recorder options"))                                       \

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                egahlin Erik Gahlin
                Reporter:
                mlautman Mary Lautman
                Reviewed By:
                David Holmes
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: