[Xapian-discuss] Filelocks not released

Richard Boulton richard at tartarus.org
Wed Dec 2 09:38:04 GMT 2009


2009/12/2 Niels Boldt <nielsboldt at gmail.com>:
> But this procedure keeps giving us errors because xapian does not release
> the locks it holds on the files, so we cannot get access to copy them. Is it
> not sufficient to call 'Dispose'. Should the object also be finalized before
> the locks on the files are release

This is a familiar problem, unfortunately.  The problem is that
Xapian's databases don't release the lock by default until the
underlying C++ database object is deleted.  In garbage collected
languages, this is a particular problem, because the time at which the
C++ object is freed is not obvious in advance.  In addition, Xapian
keeps references to the database from some of the other objects (eg, a
Document opened from the database keeps a reference to the database),
so the C++ database internals aren't freed until all such references
have gone away (by the Document being deleted).

The good news is that this is fixed in the 1.1.0 release series by
adding a "close" method to the Database object.  The bad news is that
this is a development release series, and we're not quite ready to
release the 1.2.0 stable release based on it (shouldn't be long now,
though!)

finalizing the object might help, but I'm not familiar enough with
.Net to know whether that's something you can force, and whether it
will force the underlying C++ object to be deleted.  You'd need to
make sure all objects derived from the Database object were finalised,
too, as noted above, so any solution based on this won't be as
reliable as using the close() method in the 1.1.x release series.

-- 
Richard



More information about the Xapian-discuss mailing list