Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

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 - Requested)

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

❗ 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 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 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 label Jun 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approval backport rfr Pull request is ready for review
Development

Successfully merging this pull request may close these issues.

2 participants