mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 07:14:30 +02:00
8143408: Crash during InstanceKlass unloading when clearing dependency context
Reviewed-by: kvn
This commit is contained in:
parent
2952cd0bde
commit
a03d2513aa
3 changed files with 36 additions and 25 deletions
|
@ -2063,12 +2063,16 @@ void InstanceKlass::release_C_heap_structures() {
|
|||
}
|
||||
}
|
||||
|
||||
// release dependencies
|
||||
{
|
||||
DependencyContext ctx(&_dep_context);
|
||||
int marked = ctx.remove_all_dependents();
|
||||
assert(marked == 0, "all dependencies should be already invalidated");
|
||||
}
|
||||
// Release dependencies.
|
||||
// It is desirable to use DC::remove_all_dependents() here, but, unfortunately,
|
||||
// it is not safe (see JDK-8143408). The problem is that the klass dependency
|
||||
// context can contain live dependencies, since there's a race between nmethod &
|
||||
// klass unloading. If the klass is dead when nmethod unloading happens, relevant
|
||||
// dependencies aren't removed from the context associated with the class (see
|
||||
// nmethod::flush_dependencies). It ends up during klass unloading as seemingly
|
||||
// live dependencies pointing to unloaded nmethods and causes a crash in
|
||||
// DC::remove_all_dependents() when it touches unloaded nmethod.
|
||||
dependencies().wipe();
|
||||
|
||||
// Deallocate breakpoint records
|
||||
if (breakpoints() != 0x0) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue