[Mono-dev] possible bug in ConcurrentDictionary

Debacker debackerl at gmail.com
Thu Nov 15 09:19:35 UTC 2012


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


More information about the Mono-devel-list mailing list