RFR: 8365066: RecordingStream and RemoteRecordingStream do not terminate when the associated Recording is stopped or closed externally
Erik Gahlin
egahlin at openjdk.org
Thu Aug 21 09:27:43 UTC 2025
On Sat, 9 Aug 2025 01:33:29 GMT, Chihiro Ito <cito at openjdk.org> wrote:
> Fix an issue where RecordingStream and RemoteRecordingStream do not stop when their underlying the local/remote recording stop.
>
> Introduce an internal EventSource abstraction to unify control across local (PlatformRecording) and remote (FlightRecorderMXBean) recordings, ensuring consistent propagation of stop/close and stop time to the consumer streams.
>
> Tests updated to validate lifecycle consistency:
> Verifies that stopping/closing the underlying recording (local and remote) properly stops/closes the corresponding stream.
>
> Test: jdk/jdk/jfr
Did you look into adding a FlightRecorderListener and implementing recordingStateChanged to check if the RecordingState is CLOSED and then call close() on the stream? Or perhaps it would be better to set a flag and let the thread running the stream close itself after the next flush is complete.
For a RemoteRecordingStream there is a JMX notification that can be listened on.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/26710#issuecomment-3170208274
More information about the hotspot-jfr-dev
mailing list