RFR: 8309688: Data race on java.io.ClassCache$CacheRef.strongReferent
Man Cao
manc at openjdk.org
Fri Jun 9 23:02:58 UTC 2023
On Thu, 8 Jun 2023 22:06:56 GMT, Man Cao <manc at openjdk.org> wrote:
> Hi all,
>
> 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.
Agree with the analysis that this race looks benign, and the slight change in semantics is OK. It is still a true data race and TSAN is NOT reporting a false positive though.
In our experience, the best practice is to avoid all data races unless there's a strong reason that fixing the race has undesirable effect (e.g. noticeable performance penalty). A benign race could become problematic in the future with unsuspecting changes to this file, and has higher maintenance cost in general.
I hope we can actually fix this data race. If we decide not to, at least add a comment about this intentionally benign data race.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/14386#issuecomment-1585216278
More information about the core-libs-dev
mailing list