Question

I am noticing locking (OperationalError) when using the SQLite 3.7 for python application . I am using SQLalchemy for ORM.This issue occurs on windows. I using the DB on the same machine as the application.

It seems to be working fine on ubuntu. Wondering what might be the issue? Did some older version of sqlite had this issue that got fixed?

Some thoughts :

-There is locking issue with windows NFS for SQLlite , but since i am using local filesystem this possibility is discarded.

  • Can a antivirus running on the machine cause a lock , since it reads file as and when updated. The lock on the database is never released ( i waited for like 5 min , while accessing the DB via command line). This make me think whether some hanging process was holding on to lock or the process got killed. But seems that was not the case as the only process(python bottle server) that was accessing the DB was running. It is running under single process Apache.
Was it helpful?

Solution

The way locking happens with SQLite is documented at http://www.sqlite.org/lockingv3.html - read it. On Windows you can use Sysinternal's Process Monitor to monitor who is accessing the file which will zero down on the culprit.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top