Skip to content

Conversation

@roberttoyonaga
Copy link
Contributor

@roberttoyonaga roberttoyonaga commented Nov 21, 2025

Summary

This PR changes the JFR snapshot dumping code so that multiple JFR recordings (potentially from different processes) racing to write the same dump destination won't mix their data.

Problem

The dump destination file is created and/or wiped when a recording is started, but not wiped again before actually copying over the chunks during a dump. So in the window of time between creating/wiping and dumping chunks, another recording could write to the same dump destination and have it's chunks added to the snapshot. This can happen with either a single JVM or multiple JVMs that are racing.

Proposed fix

This PR ensures that any data previously written to the dump destination is wiped before the new recording's data is written. File locking is also done while chunks are being written.

Testing:

  • new test jdk/jdk/jfr/api/recording/dump/TestDumpOverwrite.java
  • Tier 1

Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue

Issue

  • JDK-8370715: JFR: Races are possible when dumping recordings (Bug - P4)

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/28460/head:pull/28460
$ git checkout pull/28460

Update a local copy of the PR:
$ git checkout pull/28460
$ git pull https://git.openjdk.org/jdk.git pull/28460/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 28460

View PR using the GUI difftool:
$ git pr show -t 28460

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/28460.diff

Using Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Nov 21, 2025

👋 Welcome back roberttoyonaga! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk
Copy link

openjdk bot commented Nov 21, 2025

❗ This change is not yet ready to be integrated.
See the Progress checklist in the description for automated requirements.

@openjdk openjdk bot changed the title 8370715 8370715: JFR: Races are possible when dumping recordings Nov 21, 2025
@openjdk
Copy link

openjdk bot commented Nov 21, 2025

@roberttoyonaga The following label will be automatically applied to this pull request:

  • hotspot-jfr

When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command.

@roberttoyonaga roberttoyonaga marked this pull request as ready for review November 21, 2025 22:30
@openjdk openjdk bot added the rfr Pull request is ready for review label Nov 21, 2025
@mlbridge
Copy link

mlbridge bot commented Nov 21, 2025

Webrevs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

hotspot-jfr [email protected] rfr Pull request is ready for review

Development

Successfully merging this pull request may close these issues.

1 participant