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
8278239: vmTestbase/nsk/jvmti/RedefineClasses/StressRedefine failed with EXCEPTION_ACCESS_VIOLATION at 0x000000000000000d #6900
Conversation
…ith EXCEPTION_ACCESS_VIOLATION at 0x000000000000000d
|
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, thanks for fixing this!
@coleenp This change now passes all automated pre-integration checks. 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 11 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.
|
/label add hotspot-runtime |
/label remove hotspot-runtime |
@coleenp |
@coleenp |
@coleenp |
@coleenp |
I should have made this change to the JDK 18 repository. Closing this one. |
@@ -678,7 +678,7 @@ void CodeCache::nmethods_do(void f(nmethod* nm)) { | |||
|
|||
void CodeCache::metadata_do(MetadataClosure* f) { | |||
assert_locked_or_safepoint(CodeCache_lock); | |||
NMethodIterator iter(NMethodIterator::only_alive_and_not_unloading); | |||
NMethodIterator iter(NMethodIterator::only_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.
The CodeCache::metadata_do
is used in MetadataOnStackMark::MetadataOnStackMark
.
Besides RedefineClasses
the MetadataOnStackMark
is also used in ClassLoaderDataGraph::walk_metadata_and_clean_metaspaces
.
Is the change at L681 correct for ClassLoaderDataGraph::walk_metadata_and_clean_metaspaces
as well?
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 ClassLoaderDataGraph::walk_metadata_and_clean_metaspaces, it calls the version of MetadataOnStackMark that doesn't call CodeCache::metadata_do - it only walks the metadata that was saved from the full redefinition walk:
caller:
MetadataOnStackMark md_on_stack(walk_all_metadata, /redefinition_walk/false);
callee:
if (redefinition_walk) {
// We have to walk the whole code cache during redefinition.
CodeCache::metadata_do(&md_on_stack);
} else {
CodeCache::old_nmethods_do(&md_on_stack);
}
During redefinition, we have to walk the unloaded nmethods as well as the alive nmethods.
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 nmethods in the table are removed when the unloaded nmethods are flushed so that the table doesn't contain stale entries.
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.
Coleen,
Thank you for fixing this issue!
I've posted one question. Other than that it looks good to me.
Thanks,
Serguei
@sspitsyn Thanks for looking at this. Can you review the JDK 18 PR instead? |
You are right about MetadataOnStackMark. |
Thanks to @stefank and @fisk for the diagnosis. ZGC is looking at metadata in unloaded nmethods, but redefinition doesn't keep this metadata from being deallocated. Change the iterators that mark metadata in use to walk unloaded nmethods as well as other alive nmethods.
The test case reproduces the crash on windows if run in an 100 iteration loop. This fix does not crash in the same test. Also ran tier1-6.
Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.java.net/jdk pull/6900/head:pull/6900
$ git checkout pull/6900
Update a local copy of the PR:
$ git checkout pull/6900
$ git pull https://git.openjdk.java.net/jdk pull/6900/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 6900
View PR using the GUI difftool:
$ git pr show -t 6900
Using diff file
Download this PR as a diff file:
https://git.openjdk.java.net/jdk/pull/6900.diff