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")) \
- csr of
-
JDK-8224139 Deprecate -XX:FlightRecorder option
- Resolved