Possible subtle memory model error in ClassValue

Galder Zamarreno galder at redhat.com
Wed Aug 19 13:12:54 UTC 2020


On Mon, Aug 10, 2020 at 2:19 PM Doug Lea <dl at cs.oswego.edu> wrote:

> Catching up...
>
> As implied in other posts, the minimal fix is to add a trailing release
> fence (using Unsafe?) to the constructor.


FYI I have sent an RFR with the proposed fix ^
https://mail.openjdk.java.net/pipermail/core-libs-dev/2020-August/068244.html


> Or less delicately, to access
> only using acquire/release (which will cost a bit on ARM/Power, but
> probably not noticeable on x86), or most simply (but expensively) to
> declare the field volatile.
>
> Also, as Hans noted, the consensus seems to be that there not enough to
> be gained by always adding a release fence to constructors. A few errors
> like this might never occur, but other related anomalies with non-final
> field accesses would remain.
>
> -Doug
>
>


More information about the core-libs-dev mailing list