Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Concurrency issue with TableInfo in v3.3.3 #93

Closed
preslavnd opened this issue Oct 25, 2016 · 1 comment
Closed

Concurrency issue with TableInfo in v3.3.3 #93

preslavnd opened this issue Oct 25, 2016 · 1 comment

Comments

@preslavnd
Copy link

We are having a problem in a high concurrency environment when trying to use DbConnection.InsertAsync. Further inspection showed that the issue is with TableInfo._cache which is a Dictionary instead of ConcurrentDictionary (a change like this was applied in v3.3.3 on TableInfoFactory). It looks like TableInfos are fetched from the factory where the cache is using ConcurrentDictionary (so we can have multiple references from different threads to the same TableInfo), but the TableInfo's internal cache is of Dictionary<string,TableSqlCache> type.

System.NullReferenceException: Object reference not set to an instance of an object.
at System.Collections.Generic.Dictionary2.Insert(TKey key, TValue value, Boolean add) at System.Collections.Generic.ListUtils.GetValueOrCreate[T,V](IDictionary2 dict, T key, Func1 factory) at SqlFu.Builders.Crud.InsertSqlBuilder.GetCommandConfiguration() at SqlFu.CrudHelpers.InsertAsync[T](DbConnection db, T data, CancellationToken cancel, Action1 cfg)
@sapiens
Copy link
Owner

sapiens commented Oct 25, 2016

OK, try the new version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants