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

David Holmes dholmes at openjdk.java.net
Fri Oct 15 02:46:54 UTC 2021


On Fri, 15 Oct 2021 02:26:22 GMT, Coleen Phillimore <coleenp at openjdk.org> wrote:

>> 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).

@coleenp , @iklam  thanks for your patience on this. My confusion/concern was around whether `loaded_classes_do` could find the `ik` and from that use `ik->array_klasses()` to get to the `ak` and then find it has no mirror. But Coleen assures me that we never do that and will only access the `ak` via `loaded_classes_do` directly, which is safe due to the additional locking added.

Thanks,
David

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

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


More information about the hotspot-dev mailing list