[9] RFR(S): 8054402: "klass->is_loader_alive(_is_alive)) failed: must be alive" for anonymous classes
Tobias Hartmann
tobias.hartmann at oracle.com
Tue Aug 12 09:20:30 UTC 2014
Hi,
please review the following patch that fixes JDK-8054402.
Bug: https://bugs.openjdk.java.net/browse/JDK-8054402
Webrev: http://cr.openjdk.java.net/~thartmann/8054402/webrev.00/
== Problem ==
The test [1] rarely fails with the assert
'klass->is_loader_alive(_is_alive)) failed: must be alive' in
'CheckClass::check_class' (nmethod.cpp) because a IC in a compiled
method [2] references an unloaded anonymous Klass* [3] (i.e., the Klass
has an unloaded mirror class [4]). Usually, ICs are cleaned in
'nmethod::do_unloading' by 'clean_ic_if_metadata_is_dead' if they
reference stale metadata. In this case, the check for stale metadata is
not performed because 'unloading_occurred' is set to false and therefore
no class unloading should have happened.
The error is in 'SystemDictionary::do_unloading'. First,
'ClassLoaderDataGraph::do_unloading ' is invoked to remove the class
loader data of unloaded classes. Next, 'Dictionary::do_unloading' is
called to remove the system dictionary entries of dead classes.
'unloading_occurred' is only set to true if dead class loaders were
found _and_ entries were removed from the system dictionary. The problem
is that anonymous classes are not in the system dictionary. In the rare
case where only anonymous classes were unloaded, 'unloading_occurred' is
set to false even if (anonymous) class unloading occurred.
== Solution ==
The variable 'unloading_occurred' is always set to true if dead class
loaders were found.
I was able to write a jtreg test that deterministically triggers the bug.
== Testing ==
- New jtreg test
- Failing test [1]
- JPRT
Thanks,
Tobias
[1]
java/util/stream/test/org/openjdk/tests/java/util/stream/InfiniteStreamWithLimitOpTest.java
[2] java.util.stream.Streams$RangeIntSpliterator::forEachRemaining
[3]
java.util.stream.StreamSpliterators$IntWrappingSpliterator$$Lambda$170/25231275
[4] java/util/stream/StreamSpliterators$IntWrappingSpliterator$$Lambda$170
More information about the hotspot-dev
mailing list