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

Coleen Phillimore coleenp at openjdk.java.net
Fri Oct 15 02:29:48 UTC 2021


On Thu, 14 Oct 2021 16:03:22 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:
> 
>   Add assert that MultiArray_lock is held for loaded_classes_do.

Yes:
1. the shared array class becomes visible to loaded_klasses_do when ClassLoaderData::add_class() is called in Klass::restore_unshareable_info
2. the shared array class has its mirror set afterward in that same function: Klass::restore_unshareable_info

The guarantee that the two actions are atomic wrt to loaded_classes_do are because the MultiArray_lock is held while both 1 and 2 are executed.  The lock keeps 1 and 2 together.  The lock keeps Jvmti from iterating through the CLDG while the ArrayKlass is in an inconsistent state.

@iklam you're right - we'd see the ObjArrayKlass first since the InstanceKlass will be added to the CLD before its marked as is_loaded().  I don't know what the result of that would be.  You could open a new bug for that to investigate that and try to write a test case (using JVMTI that would show if it got confused).

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

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


More information about the hotspot-dev mailing list