Question re -XX:-FlightRecorder

Andrey Petushkov andrey.petushkov at gmail.com
Tue Oct 6 09:44:09 UTC 2020


Hi Erik, All,

sometimes ([1], [2]) the message is given that the command line switch
-XX:-FlightRecorder disables the JFR functionality. The problem is
that this statement is not true and in fact causes buggy behavior of
the VM. Namely:
- on a release VM ran with -XX:-FlightRecorder the call to
FlightRecorder.getFlightRecorder() succeeds and the recording can be
successfully created (much like as if no command line flag was given)
- on a debug version of VM ran with same flag the call to
FlightRecorder.getFlightRecorder() crashes the VM on assert
#  Internal Error
(/home/andrey/ws/jdk/src/hotspot/share/jfr/recorder/jfrRecorder.cpp:236),
pid=331136, tid=331137
#  assert(!is_disabled()) failed: invariant

It would be good to clarify the behavior and implement it in the
consistent way, that is, either:
- allow -XX:-FlightRecorder to actually disable JFR forever, and throw
IllegalStateException from FlightRecorder.getFlightRecorder() and
friends
- declare -XX:-FlightRecorder as no-op and remove the mentioned assert
Please note that the answer might be different for pre-13 and 13+
versions because of flag deprecation

Any opinion on this?
This might not look like an important thing at all however there were
quite a number of users (Azul customers) stumbling on unclear behavior
of the said flag so I thought it's better to have this fixed

Thanks a lot,
Andrey

[1] https://bugs.openjdk.java.net/browse/JDK-8225312
[2] jdk/src/hotspot/share/jfr/recorder/jfrRecorder.cpp,
JfrRecorder::is_disabled()


More information about the hotspot-jfr-dev mailing list