RFR: 8270091: The path of JFR emergency dump should be able to specified by the user

Yasumasa Suenaga ysuenaga at openjdk.java.net
Thu Jul 22 02:27:48 UTC 2021


On Thu, 8 Jul 2021 12:29:03 GMT, Yasumasa Suenaga <ysuenaga at openjdk.org> wrote:

> JFR will dump the recording to the file as hs_err_pid<PID>.jfr if JVM encountered fatal errors (e.g. crash). It will be dumped to current directory, and we cannot specify dump path.
> 
> In other dumps (hs_err log, heap dump, replay & inline data for JIT) can be specified it.
> 
> This is useful especially in the container application if we can specify it in JFR.
> 
> I've filed [CSR](https://bugs.openjdk.java.net/browse/JDK-8270093) for this RFE, please review it too.

`-XX:FlightRecorderOptions=dumppath=` does not work now.


$ 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


IIUC there are following consideration in[JDK-8196050](https://bugs.openjdk.java.net/browse/JDK-8196050):

* Emergency dump path for JFR
    * It happens the same timing with hs_err log - it means fatal errors which includes OOM
    * Now (JDK 17 at least) we don't have the feature to specify emergency dump path like `-XX:FlightRecorderOptions=dumppath=`
* Need to consider `maxage` and `maxsize` for emergency dump
* Need to consider default dump path if the user does not specify `-XX:StartFlightRecording=filename=`
* Emergency dump should be happened the same timing with hs_err log - it means fatal errors which includes `-XX:+CrashOnOutOfMemoryError`

I think we should add the feature to specify emergency dump path at first like this PR because `-XX:FlightRecorderOptions=dumppath=` is not available now.

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

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


More information about the hotspot-jfr-dev mailing list