RFR: 8271949: dumppath in -XX:FlightRecorderOptions does not affect [v4]

Markus Grönlund mgronlun at openjdk.java.net
Tue Sep 14 15:17:06 UTC 2021


On Sat, 4 Sep 2021 01:27:16 GMT, Yasumasa Suenaga <ysuenaga at openjdk.org> wrote:

>> We set `dumppath` in `-XX:FlightRecorderOptions` or `JFR.configure dumppath` jcmd when we want to set emergency dump path. However they do not afffect.
>> 
>> ### -XX:FlightRecorderOptions
>> 
>> 
>> $ java -XX:FlightRecorderOptions=dumppath=`pwd` -XX:StartFlightRecording -Xlog:exceptions=info --version
>> [0.032s][info][exceptions] Exception <a 'java/lang/IllegalArgumentException'{0x00000007470163b8}: Unknown argument 'dumppath' in diagnostic command.> (0x00000007470163b8)
>> thrown [open/src/hotspot/share/services/diagnosticFramework.cpp, line 215]
>> for thread 0x00007f4f700236a0
>> [0.033s][error][arguments ] Unknown argument 'dumppath' in diagnostic command.
>> Error occurred during initialization of VM
>> Failure when starting JFR on_create_vm_2
>> 
>> 
>> ### jcmd
>> 
>> `jcmd` shows the configuration change was succeeded, but it would not affect.
>> 
>> 
>> $ jcmd 1046 JFR.configure dumppath=/tmp
>> 1046:
>> Dump path: /tmp
>
> Yasumasa Suenaga has updated the pull request incrementally with two additional commits since the last revision:
> 
>  - Set absolute path to JFR emergency dump path
>  - Check write permission on JFR emergency dump path in configuration

"No, the user can set dumppath with a relative path from $PWD.
You can see it in the change of jfrEmergencyDump.cpp . get_dump_directory() would build dump path without any other paths when the path is not specified.
In addition, I changed Options::DEFAULT_DUMP_PATH to . in this PR, then it works fine. It is the evidence that JFR can handle relative path for dumppath rightly."

Ok, you fixed it in the incremental changeset 'Set absolute path to JFR emergency dump path' - that's good.

I still see the modified output in the default case, i.e. when no dumppath is specified:
<pre>
# CreateCoredumpOnCrash turned off, no core file dumped
#
# JFR recording file will be written. Location: D:\temp\SPECjbb2005\SPECjbb2005.\hs_err_pid28564.jfr <<-- note the dot
</pre>
"Check write permission on JFR emergency dump path in configuration" introduced an IllegalArgumentException if the dumppath= is invalid for some reason. This will lead to the JVM not starting:

[19.350s][error][jfr,startup] Cannot write JFR emergency dump to bad_location
java.lang.IllegalArgumentException: Cannot write JFR emergency dump to bad_location
Error occurred during initialization of VM
Failure when starting JFR on_create_vm_2

This can cause problems for users that pinpoint a location on a mounted drive, in case the mount is not reachable, perhaps because of a temporary network issue. In that case, their entire fleet of JVMs will not start. This might be too strong considering this is an option specifying what to do in an exceptional situation.

-------------

PR: https://git.openjdk.java.net/jdk/pull/5019


More information about the hotspot-jfr-dev mailing list