View Ticket
Not logged in
Ticket Hash: d4cc1cedccc51c8061ede27bbf8e6a34f9ce4813
Title: SQLiteConvert.TypeNameToDbType is not threadsafe
Status: Closed Type: Code_Defect
Severity: Severe Priority: Immediate
Subsystem: None Resolution: Duplicate
Last Modified: 2011-10-28 13:31:47
Version Found In:
{_typeNames.Add(typeName.typeName, typeName)} (line 707) can (and will im my case) be called concurrent by two different threads => {"An item with the same key has already been added."}. there is no mutex and the {if (_typeNames == null)} is not good enough. occurs in an NHibernate environment where two requests (queries) will be executed/started at the same time(millis). workaround: execute a single initial query to initialize the static {private static Dictionary<string, SQLiteTypeNames> _typeNames}

anonymous claiming to be Alex Spence added on 2011-10-28 00:23:21 UTC:
Seems like the dictionary should just be initialized in a static constructor, then you don't have to worry about it being thread safe as you wont be writing to it.

mistachkin added on 2011-10-28 13:31:47 UTC:
Duplicate of [84718e79fa], already fixed by check-in [13a3981ec0].