Database left unlocked by Tcl bindings

Eric eric at deptj.eu
Fri Mar 11 12:02:32 GMT 2016


On Thu, 10 Mar 2016 22:59:55 +0000 (UTC), Eric Lindblad <GeirfuglApS at yahoo.com> wrote:
> cf: http://permalink.gmane.org/gmane.comp.search.xapian.general/9965
> 
>> Eric J <eric <at> deptj.eu> wrote:
> 
> ...
> 
>> Earlier 8.5.x are presumably the same as 8.5.18.
> 
> If someone might post one or more code samples
> (incl. instructions for compiling, if relevant)
> and a manner of checking the following:
> 
> 1) "database locks" with Tcl bindings aren't functioning
> 2) "database locks" with Tcl bindings function correctly
> 
> if I find the time to test on GNU/Linux (32 bit) tcl8.5.11
> the specified xapian-core version number (1.2.18), I will
> post the results.

That would be useful information, thankyou.

No need to compile anything since the problem is reproducible with the
Xapian Tcl bindings alone.

All that is necessary is to install the same version of xapian-core and
xapian-bindings (with tcl of course), and install the required version
of Tcl (Tk not needed).

Terminal session 1:

  $ tclsh
  % info patchlevel
        # to check the version
  % package require Thread
        # expect to get "can't find package"
        # if you get a version number, the lock will probably not
        # function correctly for 8.5.x (x<19) or 8.6.x (x<5)
  % package require xapian 1.0.0
        # expect to see "1.2.18" (or whatever)
  % xapian::WritableDatabase db "tmp.db" $xapian::DB_CREATE_OR_OPEN
        # get something like "_e004f80100000000_p_Xapian__WritableDatabase"

Terminal session 2:

(with the same working directory)

  $ tclsh
  % info patchlevel
  % package require Thread
  % package require xapian 1.0.0
  % xapian::WritableDatabase db2 "tmp.db" $xapian::DB_CREATE_OR_OPEN
        # should get "Unable to get write lock on tmp.db: already locked"
        # if locks are functioning correctly

        # will get something like "_705b900100000000_p_Xapian__WritableDatabase"
        # if the locks are not functioning correctly

It is worth having a third terminal session with

  $ lsof -r 5 tmp.db/flintlock

to see how many times the file is open. 

If locks are functioning correctly, you will end up with something like:

COMMAND   PID USER   FD   TYPE DEVICE SIZE/OFF   NODE NAME
cat     13543 eric    5ww  REG    8,9        0 930437 tmp.db/flintlock

(what matters is having only one line and the "ww")

If locks are not functioning correctly, you will end up with something
like:

COMMAND   PID USER   FD   TYPE DEVICE SIZE/OFF   NODE NAME
cat     13549 eric    5w   REG    8,9        0 930437 tmp.db/flintlock
cat     13552 eric    9w   REG    8,9        0 930437 tmp.db/flintlock

(two lines and only a single "w" in each)

Eric
-- 
ms fnd in a lbry



More information about the Xapian-discuss mailing list