Skip to content
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

8338379: Accesses to class init state should be properly synchronized #3317

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

Conversation

MattAlp
Copy link

@MattAlp MattAlp commented Mar 4, 2025


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-8338379 needs maintainer approval

Issue

  • JDK-8338379: Accesses to class init state should be properly synchronized (Bug - P4)

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 3317

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

Using diff file

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

Using Webrev

Link to Webrev Comment

@bridgekeeper bridgekeeper bot added the oca Needs verification of OCA signatory status label Mar 4, 2025
@bridgekeeper
Copy link

bridgekeeper bot commented Mar 4, 2025

Hi @MattAlp, welcome to this OpenJDK project and thanks for contributing!

We do not recognize you as Contributor and need to ensure you have signed the Oracle Contributor Agreement (OCA). If you have not signed the OCA, please follow the instructions. Please fill in your GitHub username in the "Username" field of the application. Once you have signed the OCA, please let us know by writing /signed in a comment in this pull request.

If you already are an OpenJDK Author, Committer or Reviewer, please click here to open a new issue so that we can record that fact. Please use "Add GitHub user MattAlp" as summary for the issue.

If you are contributing this work on behalf of your employer and your employer has signed the OCA, please let us know by writing /covered in a comment in this pull request.

@openjdk
Copy link

openjdk bot commented Mar 4, 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 6600161ad46fe5b1e742409481bf225cd87f07c9 8338379: Accesses to class init state should be properly synchronized Mar 4, 2025
@openjdk
Copy link

openjdk bot commented Mar 4, 2025

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

@openjdk openjdk bot added the backport label Mar 4, 2025
@MattAlp
Copy link
Author

MattAlp commented Mar 4, 2025

/signed

@bridgekeeper bridgekeeper bot added the oca-verify Needs verification of OCA signatory status label Mar 4, 2025
@bridgekeeper
Copy link

bridgekeeper bot commented Mar 4, 2025

Thank you! Please allow for up to two weeks to process your OCA, although it is usually done within one to two business days. Also, please note that pull requests that are pending an OCA check will not usually be evaluated, so your patience is appreciated!

@MattAlp MattAlp marked this pull request as ready for review March 10, 2025 12:39
@bridgekeeper
Copy link

bridgekeeper bot commented Mar 24, 2025

Already processed the signed command

@bridgekeeper bridgekeeper bot removed oca Needs verification of OCA signatory status oca-verify Needs verification of OCA signatory status labels Mar 31, 2025
@openjdk openjdk bot added the rfr Pull request is ready for review label Mar 31, 2025
@mlbridge
Copy link

mlbridge bot commented Mar 31, 2025

Webrevs

Comment on lines +3941 to +3944
#ifdef _LP64
assert(VM_Version::supports_fast_class_init_checks(), "must support fast class initialization checks");
__ clinit_barrier(rcx, r15_thread, nullptr /*L_fast_path*/, &slow_case);
#else

Choose a reason for hiding this comment

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

This seems to be unrelated to this backport - this change was added for https://bugs.openjdk.org/browse/JDK-8320276

Copy link
Author

Choose a reason for hiding this comment

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

Good call - though we still need to layer this commit to mitigate the ARM races we were seeing. I'll open a separate backport.

bool is_reentrant_initialization(Thread *thread) { return thread == _init_thread; }
ClassState init_state() { return (ClassState)_init_state; }
ClassState init_state() const { return (ClassState) Atomic::load_acquire(&_init_state); }
const char* init_state_name() const;

Choose a reason for hiding this comment

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

This line change is not from the original changeset. It was added in https://bugs.openjdk.org/browse/JDK-8275775

Copy link
Author

Choose a reason for hiding this comment

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

As this is a somewhat separate change (enhancing jcmd), I opted to only include the change relevant to the race condition fix. I'll ask for maintainer input on the mailing list and backport JDK-8275775 in its entirety if that's preferred.

Copy link

@jbachorik jbachorik left a comment

Choose a reason for hiding this comment

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

I have verified that the changes correspond to the ones from the original changeset.

There are two locations, however, where some unrelated changes seem to have been brought in. Please, check and clean up as necessary.

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport rfr Pull request is ready for review
Development

Successfully merging this pull request may close these issues.

2 participants