RFR: JDK-8251397 NPE on ClassValue.ClassValueMap.cacheArray

Galder Zamarreno galder at redhat.com
Wed Aug 19 11:53:23 UTC 2020

Hi all,

I've created patch [1] to fix the ClassValue$ClassValueMap NPE bug in [2].

The bug has been discussed by other members in the list in thread [3].

The patch follows the simple fix suggested by Doug and others in that
exchange, e.g. [4]. That is, it adds a release fence
to ClassValue$ClassValueMap constructor to avoid the NPE.

To verify the fix, I ran the jcstress test that Paul posted in [5] and
played around with the difference fixes suggested in the thread. Adding the
release fence did indeed fix the jcstress test.

To further verify the issue, I've successfully run both the tier1 tests and
the Quarkus native testsuite with a Mandrel 20.1 built with JDK 11.0.8
version patched with the fix (higher JDKs not supported yet). Note that
this NPE happens on rare occasions.

The patch applies cleanly to JDK 11.


[1] Webrev:
[2] Bug: https://bugs.openjdk.java.net/browse/JDK-8251397

More information about the core-libs-dev mailing list