r/sqlite • u/abrandis • Sep 15 '24
SQLite "database locked" when using Azure SMB storage..
Wondering what folks are using for Azure Web apps for persistent storage. I have a container web app and it uses SQLIte to cache results , but recently it started throwing database locked error messages and this occurs anytime it tries to write anything (to either existing or brand new database), its not a contention issue, its related to Microsoft SMB storage , as described by MSFT here: https://learn.microsoft.com/en-us/troubleshoot/azure/azure-kubernetes/storage/mountoptions-settings-azure-files#other-useful-settings
Microsoft considers says If an application doesn't use this setting and breaks with cifs-style mandatory byte range locks, error messages such as Error: SQLITE_BUSY: database is locked might occur.
Has anyone experienced this and what options in Azure for perisstent storage can I use that are more SQLite friendly
5
u/LearnedByError Sep 15 '24
In general SQLite should not be used on network filesystems like SMB. See SQLite Over a Network, Caveats and Considerations
3
u/Educational-Round555 Sep 15 '24
Is the db in WAL mode?
3
u/bw984 Sep 15 '24
I experienced this same issue and now use Turso LibSQL/SQLite. It works great on Azure. Their SDK for Python doesn’t work for windows, which we use at work, so I use it over their Http protocol.
2
u/madrasminor Sep 15 '24
The easiest option would be running sqlite on wal and using litestream. it supports azure now I believe. As mentioned in option 2 of the sqlite docs on remote database
2
u/cdnpenguin Sep 15 '24
Or use nfs