8028564: Concurrent calls to CHM.put can fail to add the key/value to the map
paul.sandoz at oracle.com
Mon Dec 2 16:29:04 UTC 2013
This patch is contributed by Doug Lea and fixes two issues found in ConcurrentHashMap:
1) A problem with concurrent resizes; and
2) The skipping of elements when traversing through bins that are trees of entries.
Both of these issues can result in elements "disappearing" from the map, either because an update operation such as put failed, or because a contains operation failed to find the entry in the map.
Issue 1) was causing stream tests to fail intermittently on systems with many cores (24 to 32) (furthermore the CHM-based JDK test ToArray was also intermittently failing with less frequency).
After some investigation the cause was distilled down to the use of ConcurrentHashMap in the F/J task used by Stream.forEachOrdered.
Issue 2) was serendipitously reported on concurrentcy-interest just yesterday :-)
Both issues have test cases associated with them that have been tuned to reproduce on systems with low cores i.e. my MacBook!
More information about the core-libs-dev