I am using EFCore SQLite with SignalR.
When there are many clients connect at the same time, database can not changes (insert/update) anymore, this exception throws: "Can not rollback - No transaction active"
A client connects with query param that contains its info, then:
- Look into the database, if clientName exists then update its info. Otherwise, add new.
- After connected, client name call GetData() that returns all clients info etc...
- There are about 100 clients connect at the same time.
Logs:
An exception occurred in the database while iterating the results of a query.
System.InvalidOperationException: A second operation started on this context before a previous operation completed. Any instance members are not guaranteed to be thread safe.
Then
Microsoft.Data.Sqlite.SqliteException (0x80004005): SQLite Error 5: 'database is locked'.
After that, when I try to insert or update things:
Cannot rollback - No transaction is active
Is there a workaround? This only happens on production with 50 clients+, so it's hard to debug when development.
Any help will be appreciated!