-
Notifications
You must be signed in to change notification settings - Fork 6.2k
8358003: KlassTrainingData initializer reads garbage holder #25623
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
Conversation
|
mach5 testing in progress, will report back once it's done. |
|
👋 Welcome back iveresov! A progress list of the required criteria for merging this PR into |
|
@veresov This change now passes all automated pre-integration checks. ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details. After integration, the commit message for the final commit will be: 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 60 new commits pushed to the
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. ➡️ To integrate this PR with the above commit message to the |
shipilev
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense. I was dumbfounded what was "previous handle", when we are in constructor. I suspected it was something about placement-new code somewhere.
Webrevs
|
iwanowww
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good.
|
It seems like we don't need these release_stores either since the constructor is always run under a lock. |
| Atomic::release_store(&_holder, const_cast<InstanceKlass*>(klass)); | ||
| assert(klass != nullptr, ""); | ||
| Handle hm(JavaThread::current(), klass->java_mirror()); | ||
| jobject hmj = JNIHandles::make_global(hm); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why don't you use OopStorage for this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are there any advantages?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, transitioned to OopStrage. Please take a look if correctly. I'll be back when the testing is done.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The advantage of OopStorage is that jni handles aren't trusted because they come from outside jni calls so have some safefetch code, but OopStorage are trusted so presumably faster.
|
Testing is ok |
|
Ok, testing was clean. Please take another look. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right off the bat, before I look at the rest of it: I don't think there is a need to introduce another OopStorage class just for these handles. We already see it would probably require touchups in other code that enumerates OopStorages. So instead, use VM Global one? I.e. do:
handle = OopHandle(Universe::vm_global(), obj);
Also I cannot spot where we clean these. Note that for OopHandle-s, you have to explicitly call .release, likely in KlassTrainingData destructor.
|
We don't need to release them. KTDs are never destroyed. They just die with the process. |
|
I kind of need to push it today before the fork. Let's try making changes to this minimal. I'm also fine reverting back to before @coleenp suggested OopStorage. And we can address the remaining concerns later. |
Yeah, let's do OopStorage rewrite as the followup. |
|
Ok, I reverted this to before the OopStorage changes. And filed https://bugs.openjdk.org/browse/JDK-8358580 to rethink it later. @coleenp are you ok with that? |
coleenp
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm fine with this and the follow-up issue.
| Atomic::release_store(&_holder, const_cast<InstanceKlass*>(klass)); | ||
| assert(klass != nullptr, ""); | ||
| Handle hm(JavaThread::current(), klass->java_mirror()); | ||
| jobject hmj = JNIHandles::make_global(hm); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The advantage of OopStorage is that jni handles aren't trusted because they come from outside jni calls so have some safefetch code, but OopStorage are trusted so presumably faster.
|
/integrate |
|
Going to push as commit ae1892f.
Your commit was automatically rebased without conflicts. |
Simplify KlassTrainingData constructor. The lines in question come from the old pre-CDS world. They are not needed anymore.
Progress
Issue
Reviewers
Reviewing
Using
gitCheckout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/25623/head:pull/25623$ git checkout pull/25623Update a local copy of the PR:
$ git checkout pull/25623$ git pull https://git.openjdk.org/jdk.git pull/25623/headUsing Skara CLI tools
Checkout this PR locally:
$ git pr checkout 25623View PR using the GUI difftool:
$ git pr show -t 25623Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/25623.diff
Using Webrev
Link to Webrev Comment