On Thu, 8 Jun 2023 22:06:56 GMT, Man Cao <m...@openjdk.org> wrote:

> Could anyone review this small fix for a data race in 
> java.io.ClassCache$CacheRef? This fix makes the code safer by making the code 
> data-race-free.

If I read the existing code correctly, ClassCache::get can't return null. If 
there are two threads racing then it's okay for both to read a non-null strong 
ref, one read non-null and the other null, or both read null (if someone else 
cleared it). It just means there may be fallback to the soft ref or if that 
gets cleared then the remove/re-compute the ClassValue. Maybe more eyes are 
needed but it could be that this TSAN is reporting a false positive here.

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

PR Comment: https://git.openjdk.org/jdk/pull/14386#issuecomment-1584614945

Reply via email to