RFR: 8274338: com/sun/jdi/RedefineCrossEvent.java failed "assert(m != __null) failed: NULL mirror"
Coleen Phillimore
coleenp at openjdk.java.net
Wed Oct 13 22:51:52 UTC 2021
On Wed, 13 Oct 2021 20:29:46 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.
If you look at everywhere array classes are created, there's a MultiArray_lock protecting them until the mirror is created so that it seems atomic when added to the ClassLoaderData::_klasses and the mirror is created and added to the klass. The JVMTI code locks MultiArray_lock to iterate through the classes (with a similar comment, actually copied).
The restore_unshareable_info code doesn't lock restoring the mirror and adding the array Klass to the ClassLoaderData, but it should. The lock could be lower down but just taking it once seemed just as good and in a better place with less conditionals.
-------------
PR: https://git.openjdk.java.net/jdk/pull/5935
More information about the hotspot-dev
mailing list