[concurrency-interest] Potential data race in java.util.concurrent.ConcurrentHashMap at the fields TreeNode.left and right

Thomas Krieger thomas.krieger at vmlens.com
Thu Mar 26 03:55:15 EDT 2020

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.

Thomas Krieger

More information about the Concurrency-interest mailing list