RFR: 8364090: Dump JFR recording on CrashOnOutOfMemoryError
Erik Gahlin
egahlin at openjdk.org
Fri Jul 25 08:24:54 UTC 2025
On Fri, 25 Jul 2025 08:05:03 GMT, Yasumasa Suenaga <ysuenaga at openjdk.org> wrote:
>> src/hotspot/share/runtime/java.cpp line 466:
>>
>>> 464: }
>>> 465:
>>> 466: JFR_ONLY(Jfr::on_vm_shutdown(true, halt);)
>>
>> You set oom to true here, why?
>
> To keep current behavior.
>
> Before this change, 1st argument of `on_vm_shutdown` is `exception_handler`. You can see it on this change. If `exception_handler` sets to `false`, emergency dump handles it as OOM:
>
>
> static void post_events(bool exception_handler, Thread* thread) {
> if (exception_handler) {
> EventShutdown e;
> e.set_reason("VM Error");
> e.commit();
> } else {
> // OOM
> LeakProfiler::emit_events(max_jlong, false, false);
> }
> EventDumpReason event;
> event.set_reason(exception_handler ? "Crash" : "Out of Memory");
> event.set_recordingId(-1);
> event.commit();
> }
>
>
> I'm not sure this code would be called when OOM happens, but I think we need to keep this behavior in this change - this change focuses on working emergency dump with `CrashOnOutOfMemoryError`.
Could you call the parameter something more fitting? Perhaps emit_old_object_samples, if that is the new purpose of the flag?
I think the OldObjectSample event should only be emitted if an emergency dump occurs, preferably only on oom.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/26468#discussion_r2230486262
More information about the hotspot-jfr-dev
mailing list