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
Currently limiting the db connections to one to avoid the "database table is locked" errors when multiple connections access the same table simultaneously. This seems to be a limitation of the sqlx crate. Issue raised upstream: launchbadge/sqlx#1649
EDIT: with the shared cache disabled we are now facing different issues which forced us to go back to single db connections:
Without shared cache, it's impossible to use memory databases with multiple connections as each connection would create its own separate db. This means we would have to change our testing strategy. One option is to use temporary files, but we need to be careful that we properly delete them at the end of the tests and that we don't delete them prematurely (which would lead to "Disk I/O" errors). NOTE: we could also use single connection + memory db in tests and multiple connection + file db in production. That's not ideal as the test diverges a bit too much from the production and it could miss bugs.
With file databases and multiple connections I was still experiencing SQLITE_BUSY errors even with the busy timeout set. After some experimentation I found out that setting the synchronous pragma to NORMAL (default is FULL) seemed to have fixed those errors. It's unclear why that is the case and also whether it's really a fix or it just made the problem less likely to occur. It needs more investigation.
The text was updated successfully, but these errors were encountered:
One option to do this without the upstream change is to use databases in temporary files instead of in memory. That would avoid shared cache which is what causes the table locked errors.
Currently limiting the db connections to one to avoid the "database table is locked" errors when multiple connections access the same table simultaneously. This seems to be a limitation of the sqlx crate. Issue raised upstream: launchbadge/sqlx#1649
EDIT: with the shared cache disabled we are now facing different issues which forced us to go back to single db connections:
Without shared cache, it's impossible to use memory databases with multiple connections as each connection would create its own separate db. This means we would have to change our testing strategy. One option is to use temporary files, but we need to be careful that we properly delete them at the end of the tests and that we don't delete them prematurely (which would lead to "Disk I/O" errors). NOTE: we could also use single connection + memory db in tests and multiple connection + file db in production. That's not ideal as the test diverges a bit too much from the production and it could miss bugs.
With file databases and multiple connections I was still experiencing
SQLITE_BUSY
errors even with the busy timeout set. After some experimentation I found out that setting thesynchronous
pragma toNORMAL
(default isFULL
) seemed to have fixed those errors. It's unclear why that is the case and also whether it's really a fix or it just made the problem less likely to occur. It needs more investigation.The text was updated successfully, but these errors were encountered: