Potential data race in java.util.concurrent.ConcurrentHashMap at the fields TreeNode.left and right

Thomas Krieger via Concurrency-interest <[email protected]> Thu, 26 Mar 2020 08:55:15 +0100 (CET)
Newsgroups gmane.comp.java.jsr.166-concurrency
Message-ID <[email protected]>
I think there is a data race in the class java.util.concurrent.ConcurrentHashMap.
When reading from the fields TreeNode.left and TreeNode.right using get and writing to those fields using put those fields are not synchronized.
I think they both should be volatile similar to the field next of the class Node.


I have created a test in the git project https://github.com/vmlens/race-conditions-java.git to reproduce the data race using https://vmlens.com, a tool I have written to test multi-threaded Java.

Regards
Thomas Krieger
_______________________________________________
Concurrency-interest mailing list
[email protected]
http://cs.oswego.edu/mailman/listinfo/concurrency-interest