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
In the SQLite adapter's StatementExec method, the opened transaction doesn't get rolled back if compat.ExecContext returns an error. This came up in a personal project after hitting a constraint violation - all further write calls to the DB would return database is locked errors until I restarted the application.
I was able to reproduce the behavior using this test:
~/src/emm035/playground $ go test -v -count 1 .
--- FAIL: TestActions (20.81s)
--- FAIL: TestActions/Insert_into_table_1 (10.39s)
db_test.go:85: database is locked
--- FAIL: TestActions/Insert_into_table_2 (10.41s)
db_test.go:94: database is locked
FAIL
FAIL github.com/emm035/playground 23.884s
FAIL
Adding a rollback statement to the error handling branch here seemed to stop the locking in my application and the test is passing:
~/src/emm035/playground $ go test -v -count 1 .
ok github.com/emm035/playground 0.114s
I'd be more than happy to submit a PR with the change, but wanted to make sure this is fixing the actual problem and not just obscuring another issue 🙂
The text was updated successfully, but these errors were encountered:
In the SQLite adapter's StatementExec method, the opened transaction doesn't get rolled back if
compat.ExecContext
returns an error. This came up in a personal project after hitting a constraint violation - all further write calls to the DB would returndatabase is locked
errors until I restarted the application.I was able to reproduce the behavior using this test:
db_test.go
with the following output:
Adding a rollback statement to the error handling branch here seemed to stop the locking in my application and the test is passing:
I'd be more than happy to submit a PR with the change, but wanted to make sure this is fixing the actual problem and not just obscuring another issue 🙂
The text was updated successfully, but these errors were encountered: