-
Notifications
You must be signed in to change notification settings - Fork 6.2k
8280454: G1: ClassLoaderData verification keeps CLDs live that causes problems with VerifyDuringGC during Remark #8949
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
… problems with VerifyDuringGC during Remark
|
/label add hotspot-runtime |
|
👋 Welcome back tschatzl! A progress list of the required criteria for merging this PR into |
|
@tschatzl |
Webrevs
|
stefank
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.
It's unclear to me why this works. You've removed the "keep alive" property from the iterator, but it looks like the verification code still uses "keep alive" loads on the class loaders.
Could you explain how this patch prevents those class loaders from being kept alive?
| ClassLoaderDataGraphIteratorNoKeepAlive iter; | ||
| while (ClassLoaderData* cld = iter.get_next()) { | ||
| if (cld->dictionary() != nullptr) { | ||
| cld->dictionary()->verify(); |
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.
If I'm reading the code correctly, it seems like this function keeps the class loader alive:
void Dictionary::verify() {
guarantee(number_of_entries() >= 0, "Verify of dictionary failed");
ClassLoaderData* cld = loader_data();
// class loader must be present; a null class loader is the
// bootstrap loader
guarantee(cld != NULL &&
(cld->the_null_class_loader_data() || cld->class_loader()->is_instance()),
"checking type of class_loader");
The cld->class_loader() call resolves the OopHandle, which should keep it alive.
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.
That never happens because afaict cld->the_null_class_loader_data() is always non-NULL except during very early bootstrapping. I do not think it can ever be NULL for a java instantiated class loader, so the second clause is never executed there. Some additional logging in the test proved that.
I can find three where this idiom is used to see whether the null CLD is initialized - I could add a static is_null_class_loader_data_initialized() predicate to ClassLoaderData - preferably in a separate CR.
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.
Yes, in this CR you should change "the_null_class_loader_data()" to "is_the_null_class_loader_data()" and verify that your test still works.
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.
This seems okay and worth adding the ClassLoaderdataGraphIteratorBase for this case. Please make the change in my comment though with this change, and retest your test.
| ClassLoaderDataGraphIteratorNoKeepAlive iter; | ||
| while (ClassLoaderData* cld = iter.get_next()) { | ||
| if (cld->dictionary() != nullptr) { | ||
| cld->dictionary()->verify(); |
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.
Yes, in this CR you should change "the_null_class_loader_data()" to "is_the_null_class_loader_data()" and verify that your test still works.
|
@tschatzl 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 190 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 |
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.
Still good.
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.
Looks good. Thank you for fixing this.
|
Going to push as commit 94b473e.
Your commit was automatically rebased without conflicts. |
Hi all,
can I have reviews for this change that makes a few CLDG iterations no-keepalive during GC pauses?
This fixes a bug where the
VerifyDuringGCverification otherwise kept alive all classes, effectively disabling class unloading during (g1) concurrent mark.Afaict this verification code is only every called during GC pauses, so the change should be fine.
As for the change itself, I tried to avoid cluttering the code with
ClassLoaderDataGraphIterator<>by using typedefs - unfortunately only C++ 17 allows omitting the<>if all template parameters are defaulted.There is also a new test case for just this.
Testing: tier1-5
Thanks,
Thomas
Progress
Issue
Reviewers
Reviewing
Using
gitCheckout this PR locally:
$ git fetch https://git.openjdk.org/jdk pull/8949/head:pull/8949$ git checkout pull/8949Update a local copy of the PR:
$ git checkout pull/8949$ git pull https://git.openjdk.org/jdk pull/8949/headUsing Skara CLI tools
Checkout this PR locally:
$ git pr checkout 8949View PR using the GUI difftool:
$ git pr show -t 8949Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/8949.diff