RFR: 8264634: CollectCLDClosure collects duplicated CLDs when dumping dynamic archive [v2]

Yi Yang yyang at openjdk.java.net
Mon Apr 5 04:33:25 UTC 2021


On Mon, 5 Apr 2021 03:45:58 GMT, Yi Yang <yyang at openjdk.org> wrote:

>> Hi, Yi
>>   The _loaded_cld is a global list, in this case it looks contain duplicated CLD in it. 
>>    The duplication could from the thread run shutdown hook.
>>    Could you try 
>>   if (!cld->is_unloading()) {
>>       cld->inc_keep_alive();
>> `+`     if (!_loaded_cld->contains(cld)) {
>>       _loaded_cld->append(cld);
>> `+`  }
>>     }
>> Please let us know if you can avoid the crash.
>
>> Hi, Yi
>> The _loaded_cld is a global list, in this case it looks contain duplicated CLD in it.
>> The duplication could from the thread run shutdown hook.
>> Could you try
>> if (!cld->is_unloading()) {
>> cld->inc_keep_alive();
>> `+` if (!_loaded_cld->contains(cld)) {
>> _loaded_cld->append(cld);
>> `+` }
>> }
>> Please let us know if you can avoid the crash.
> 
> Hi Yumin, this fix still crashes because the CLDs collected at the first invocation of MetaspaceShared::link_and_cleanup_shared_classes are not cleaned, they will decrement their _keep_alives as before at the second invocation of MetaspaceShared::link_and_cleanup_shared_classes.

Hi Ioi,

> Also, to improve modularity, I think we should move the dec_keep_alive loop into the destructor of CollectCLDClosure.
> Also, loaded_cld can be moved as a field into CollectCLDClosure.

Suggestions make sense, changed. Tests under runtime/cds/ are all passed with slowdebug mode.

-------------

PR: https://git.openjdk.java.net/jdk/pull/3320


More information about the hotspot-runtime-dev mailing list