[9] RFR(S): 8054402: "klass->is_loader_alive(_is_alive)) failed: must be alive" for anonymous classes

Coleen Phillimore coleen.phillimore at oracle.com
Tue Aug 12 14:11:28 UTC 2014


Hi, Yes, I was about to make both of these comments.  Thank you for 
finding this bug!

There is some dead code (if statement) in dictionary::do_unloading() 
when you remove this flag that you can remove also.

Also, about the test.  I thought AnonymousClass was something we were 
going to discontinue support for (or was it a different AnonymousClass)?


Thanks!
Coleen


On 8/12/14, 9:49 AM, Vladimir Kozlov wrote:
> Nice work, Tobias!
> Should you also modify Dictionary::do_unloading() since it is the only 
> place where it is called and the result is not used anymore?
> I don't think you need IgnoreUnrecognizedVMOptions flag in the test.
>
> Thanks,
> Vladimir
>
> On 8/12/14 2:20 AM, Tobias Hartmann wrote:
>> 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