8028564: Concurrent calls to CHM.put can fail to add the key/value to the map

Chris Hegarty chris.hegarty at oracle.com
Wed Dec 4 11:00:05 UTC 2013


On 04/12/13 10:31, Paul Sandoz wrote:
> I have reviewed Doug's code, just need someone to quickly review the test code.

The tests look pretty comprehensive to me. I see no issues with them.

-Chris.

>
> Paul.
>
> On Dec 2, 2013, at 5:29 PM, Paul Sandoz <Paul.Sandoz at oracle.com> wrote:
>
>> Hi,
>>
>> http://cr.openjdk.java.net/~psandoz/tl/JDK-8028564-concurrent-resize/webrev/
>>
>> 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!
>>
>> Paul.
>



More information about the core-libs-dev mailing list