Skip to content

Conversation

krk
Copy link
Contributor

@krk krk commented Jun 20, 2025

Backport of JDK-8212155.

The patch did not apply cleanly due to a merge conflict. The original code JvmtiThreadState::state_for(JavaThread::current()) had already been refactored to JavaThread::current()->jvmti_thread_state() in this branch.

I have also removed the @requires vm.jvmti tag from the test, as it is not supported by the jtreg version in JDK 11.

The DynamicCodeGeneratedTest was confirmed to fail without this patch and passes with it.


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
  • JDK-8212155 needs maintainer approval

Issue

  • JDK-8212155: Race condition when posting dynamic_code_generated event leads to JVM crash (Bug - P3 - Approved)

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk11u-dev.git pull/3051/head:pull/3051
$ git checkout pull/3051

Update a local copy of the PR:
$ git checkout pull/3051
$ git pull https://git.openjdk.org/jdk11u-dev.git pull/3051/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 3051

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

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk11u-dev/pull/3051.diff

Using Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Jun 20, 2025

👋 Welcome back krk! 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 Jun 20, 2025

@krk This change now passes all automated pre-integration checks.

After integration, the commit message for the final commit will be:

8212155: Race condition when posting dynamic_code_generated event leads to JVM crash

Reviewed-by: shade

You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed.

At the time when this comment was updated there had been 5 new commits pushed to the master branch:

As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details.

As you do not have Committer status in this project an existing Committer must agree to sponsor your change. Possible candidates are the reviewers of this PR (@shipilev) but any other Committer may sponsor as well.

➡️ To flag this PR as ready for integration with the above commit message, type /integrate in a new comment. (Afterwards, your sponsor types /sponsor in a new comment to perform the integration).

@openjdk openjdk bot changed the title Backport 64ec8b3e5c8a8d44c92591710d73b833f13c1500 8212155: Race condition when posting dynamic_code_generated event leads to JVM crash Jun 20, 2025
@openjdk
Copy link

openjdk bot commented Jun 20, 2025

This backport pull request has now been updated with issue from the original commit.

@openjdk openjdk bot added backport Port of a pull request already in a different code base rfr Pull request is ready for review labels Jun 20, 2025
@mlbridge
Copy link

mlbridge bot commented Jun 20, 2025

Webrevs

@krk
Copy link
Contributor Author

krk commented Jun 23, 2025

Tagging reviewer of the original commit: @sspitsyn

Copy link
Member

@shipilev shipilev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense. Please make sure to run the remaining jvmti tests:

# JVMTI tests
vmTestbase_nsk_jvmti = \
vmTestbase/nsk/jvmti

hotspot_serviceability = \
serviceability

@openjdk
Copy link

openjdk bot commented Jun 27, 2025

⚠️ @krk This change is now ready for you to apply for maintainer approval. This can be done directly in each associated issue or by using the /approval command.

@krk
Copy link
Contributor Author

krk commented Jun 27, 2025

==============================
Test summary
==============================
   TEST                                              TOTAL  PASS  FAIL ERROR
   jtreg:test/hotspot/jtreg:vmTestbase_nsk_jvmti       640   640     0     0
   jtreg:test/hotspot/jtreg:hotspot_serviceability     178   178     0     0

@krk
Copy link
Contributor Author

krk commented Jun 27, 2025

/approval request Fixes a critical JVM crash from a race condition when posting dynamic_code_generated JVMTI events.

The patch required manual conflict resolution in JvmtiExport.cpp because JvmtiThreadState::state_for() was previously refactored in this branch. The new regression test, DynamicCodeGeneratedTest, required the removal of an unsupported jtreg tag and was verified to fail without the patch and pass with it.

This fix has been stable in mainline since June 2021. The risk is low, as the fix is a minimal, defensive check.

@openjdk
Copy link

openjdk bot commented Jun 27, 2025

@krk
8212155: The approval request has been created successfully.

@openjdk openjdk bot added the approval Requires approval; will be removed when approval is received label Jun 27, 2025
@shipilev
Copy link
Member

@gnu-andrew, @jerboaa -- want to take a look at this one? Looks fairly safe to me, and avoids production JVM crashes with profilers :)

@openjdk openjdk bot added ready Pull request is ready to be integrated and removed approval Requires approval; will be removed when approval is received labels Jul 15, 2025
@jerboaa
Copy link
Contributor

jerboaa commented Jul 15, 2025

Approved. Please follow up with a backport of https://bugs.openjdk.org/browse/JDK-8268463.

@krk
Copy link
Contributor Author

krk commented Jul 15, 2025

/integrate

Thanks, will do.

@krk
Copy link
Contributor Author

krk commented Jul 16, 2025

/integrate

@openjdk openjdk bot added the sponsor Pull request is ready to be sponsored label Jul 16, 2025
@openjdk
Copy link

openjdk bot commented Jul 16, 2025

@krk
Your change (at version 9f252d8) is now ready to be sponsored by a Committer.

@openjdk
Copy link

openjdk bot commented Jul 16, 2025

@krk
Your change (at version 9f252d8) is now ready to be sponsored by a Committer.

@shipilev
Copy link
Member

/sponsor

@openjdk
Copy link

openjdk bot commented Jul 16, 2025

Going to push as commit 971e6dc.
Since your change was applied there have been 5 commits pushed to the master branch:

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot added the integrated Pull request has been integrated label Jul 16, 2025
@openjdk openjdk bot closed this Jul 16, 2025
@openjdk openjdk bot removed ready Pull request is ready to be integrated rfr Pull request is ready for review labels Jul 16, 2025
@openjdk openjdk bot removed the sponsor Pull request is ready to be sponsored label Jul 16, 2025
@openjdk
Copy link

openjdk bot commented Jul 16, 2025

@shipilev @krk Pushed as commit 971e6dc.

💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport Port of a pull request already in a different code base integrated Pull request has been integrated
Development

Successfully merging this pull request may close these issues.

3 participants