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

SqliteConnectionFactory.cs is not thread-safe #26612

Closed
sebastienros opened this issue Nov 10, 2021 · 2 comments · Fixed by #26658
Closed

SqliteConnectionFactory.cs is not thread-safe #26612

sebastienros opened this issue Nov 10, 2021 · 2 comments · Fixed by #26658
Assignees
Labels
area-adonet-sqlite closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. Servicing-approved type-bug
Milestone

Comments

@sebastienros
Copy link
Member

Reads on the Dictionary are not locked with the write operations, which is not supported.
Suggestion is to use a ConcurrentDictionary and remove some of the locks, or use a ReaderWriterLockSlim.

https://github.com/dotnet/efcore/blob/main/src/Microsoft.Data.Sqlite.Core/SqliteConnectionFactory.cs#L53

c.f. Dictionary source that is can throw an exception if the collection was changed while reads occur.
https://source.dot.net/#System.Private.CoreLib/Dictionary.cs,398

@roji
Copy link
Member

roji commented Nov 10, 2021

/cc @bricelam

roji added a commit to roji/efcore that referenced this issue Nov 12, 2021
roji added a commit to roji/efcore that referenced this issue Nov 12, 2021
@roji roji added the closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. label Nov 15, 2021
@roji roji self-assigned this Nov 15, 2021
@ajcvickers ajcvickers added this to the 6.0.1 milestone Nov 16, 2021
@ajcvickers
Copy link
Member

FYI for those impacted by this issue: EF Core 6.0.1 is now available from NuGet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-adonet-sqlite closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. Servicing-approved type-bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants