[Xapian-discuss] DatabaseLockError: Unable to acquire database write lock

Olly Betts olly at survex.com
Wed Mar 7 17:43:04 GMT 2007


On Tue, Mar 06, 2007 at 06:44:38PM -0800, Alexander Lind wrote:
> Perhaps an application of yours that acquires a writelock (which is a 
> file in the xapian index directory) and then crashes

With some of the bindings, the WritableDatabase destructor may not get
called automatically at script end, which can result in loss of
unflushed changes and a stale lock file to be left (with quartz that is
- flint uses a different locking technique which releases the lock
automatically when the process exits).

You can generally overwrite the WritableDatabase object with another
value (e.g. in PHP, "$db = null;") to cause referencing counting to
call the C++ destructor.

> or is simply run concurrently as your other program is causing this?

That's the other possibility.  If you're certain no other writing
process has the database open (fuser or lsof can help here) then
just delete the stale lock file and all should be well.

Cheers,
    Olly



More information about the Xapian-discuss mailing list