RFR: 8274338: com/sun/jdi/RedefineCrossEvent.java failed "assert(m != __null) failed: NULL mirror" [v2]

Coleen Phillimore coleenp at openjdk.java.net
Thu Oct 14 11:55:49 UTC 2021


On Thu, 14 Oct 2021 11:48:17 GMT, Coleen Phillimore <coleenp at openjdk.org> wrote:

>> The MultiArray_lock isn't held when restoring shared arrays, so an observer can find one that isn't completely restored.
>> Tested with tier1-3 in progress, and CDS tests locally.  Not really reproduceable otherwise even with sleeps.
>
> Coleen Phillimore has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Fix comment.

Thanks Ioi for the review and for answering David's questions.  Let me try to answer further.

In ClassLoaderData::loaded_classes_do, the InstanceKlass is added to the CLD but it's not marked as 'loaded' until the mirror is created, so it won't be followed.  The array case has no such initialization state field, so both adding to CLD and updating the mirror must be as-if atomic.  This is accomplished by locking the MultiArray_lock.

In the creation case, the ArrayKlass is added to the CLD after the mirror is created, still with the lock.  In the restore_unshareable_info, the class is added to the CLD first because it shares code with InstanceKlass (it's in Klass::restore_unshareable_info).  We could add some 'if' statements in Klass::restore_unshareable_info to fix the order of the ArrayKlass case, but taking out the lock will still be needed to be consistent with the creation case, and is sufficient here also.

Also, I would not like to take out the null check for this case.  Having code find a null mirror further down will likely cause problems in whatever the do_klass() callback wants (in this case, likely wants the mirror).

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

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


More information about the hotspot-dev mailing list