You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Nov 1, 2018. It is now read-only.
Here is some over-simplified code demonstrating the problem.
varconnectionString="Data Source=transations;Mode=Memory;Cache=Shared";using(varconnection1=newSqliteConnection(connectionString))using(varconnection2=newSqliteConnection(connectionString)){connection1.Open();connection2.Open();connection1.ExecuteNonQuery("CREATE TABLE Data (Value); INSERT INTO Data VALUES (0);");using(connection1.BeginTransaction())using(connection2.BeginTransaction()){connection1.ExecuteNonQuery("SELECT * FROM Data");connection2.ExecuteNonQuery("SELECT * FROM Data");// Each command is waiting for the other transaction to completeconnection1.ExecuteNonQuery("UPDATE Data SET Value = 1");connection2.ExecuteNonQuery("UPDATE Data SET Value = 2");}}
In version 1.x, we avoided the deadlock since connection2 couldn't begin the transaction until the one on connection1 completed.
In version 2.0.0, we allow both transactions to begin which eventually leads to the deadlock. Note, one of the commands eventually times out and throws rolling back its transaction unblocking the application.
Here is some over-simplified code demonstrating the problem.
In version 1.x, we avoided the deadlock since
connection2couldn't begin the transaction until the one onconnection1completed.In version 2.0.0, we allow both transactions to begin which eventually leads to the deadlock. Note, one of the commands eventually times out and throws rolling back its transaction unblocking the application.