[Mono-dev] possible bug in ConcurrentDictionary

Daniel Lo Nigro lists at dan.cx
Thu Nov 15 12:19:40 UTC 2012


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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ximian.com/pipermail/mono-devel-list/attachments/20121115/6f7c03b1/attachment.html>


More information about the Mono-devel-list mailing list