[Mono-dev] possible bug in ConcurrentDictionary

Debacker debackerl at gmail.com
Thu Nov 15 18:10:49 UTC 2012


Thanks Daniel, indeed I checked the wrong repository on github, it was
at github.com/mosa/Mono-Class-Libraries

My bad

On Thu, Nov 15, 2012 at 1:19 PM, Daniel Lo Nigro <lists at dan.cx> wrote:
> As far as I can tell, this was fixed way back in 2010. There is a changeset
> labelled as "Add support for storing elements with the same hashcode in
> ConcurrentDictionary. Add corresponding unit test." and the line you quoted
> was changed to this:
>
> internalDictionary.Delete (Hash (key), key, out data);
>
> https://github.com/mono/mono/commit/09185b9e811dfe702809cfd5960e523ca8f4e7f6
>
>
> On Thu, Nov 15, 2012 at 8:19 PM, Debacker <debackerl at gmail.com> wrote:
>>
>> Hello,
>>
>> While reading the code of ConcurrentDictionary and SplitOrderedList, I
>> believe I have identified an issue. In method
>> ConcurrentDictionary.TryRemove, you'll see this line:
>>
>> bool result = internalDictionary.Delete (Hash (key), out data);
>>
>> Only key's hash is used, not the key itself. Consequently, two
>> different keys with hash collision will be indistinguishable by
>> SplitOrderedList.
>>
>> Key hash collisions are probably very rare, but it's not standard
>> compliant.
>>
>> Regards,
>> Laurent Debacker
>> _______________________________________________
>> Mono-devel-list mailing list
>> Mono-devel-list at lists.ximian.com
>> http://lists.ximian.com/mailman/listinfo/mono-devel-list
>
>


More information about the Mono-devel-list mailing list