RFR: 8373439: Deadlock between flight recorder & VMDeath
Erik Gahlin
egahlin at openjdk.org
Mon Dec 15 09:43:41 UTC 2025
On Fri, 12 Dec 2025 17:08:14 GMT, Erik Gahlin <egahlin at openjdk.org> wrote:
>> A simple `PlatformRecorder.isInShutDown` check is added to `PlatformRecording.start` to prevent any new recording from start after the JVM initiates it's shutdown hooks
>>
>> A new test was added that fails without the change & passes with it
>>
>> I also ran `tier1`, `tier2` as well as `jdk_jfr` on Linux x86
>
> src/jdk.jfr/share/classes/jdk/jfr/internal/PlatformRecording.java line 108:
>
>> 106: synchronized (recorder) {
>> 107: if (PlatformRecorder.isInShutDown()) {
>> 108: throw new IllegalStateException("Flight recorder is already shutdown");
>
> I need to think about if throwing ISE is the best alternative here.
A user may call recording.start() at any time, and throwing an ISE would break the current API and require callers to guard against shutdown. This would affect not just the Recording class but also RecordingStream and FlightRecorder, and possibly the FlightRecorderMXBean. Another alternative is to add PlatformRecorder.isInShutdown checks in various places (stop, dump etc) to make it a dummy recording, but that becomes complicated. An internal checked exception could help ensure all paths are covered. A third alternative is to avoid destroying native JFR at shutdown. That said, we still need to clean up the disk repository. Markus will be back in January. I think we should wait until he returns to get more input on this.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/28767#discussion_r2618681154
More information about the hotspot-jfr-dev
mailing list