On Tue, Jun 21, 2011 at 07:18:08PM +0200, Enrico Zini wrote:

> The locking strategy of u-a-x-i is would be attach to an already running
> indexer instead of raising an error, so before applying this patch I'd
> like to see if there isn't something else to fix instead.

Indeed there's a bug somewhere: the server isn't, for all practical
purposes, locking the lockfile.

The problem is here:

    def lock(self):
        [...]
        lockfd = os.open(axi.XAPIANDBLOCK, os.O_RDWR | os.O_CREAT)
        lockpyfd = os.fdopen(lockfd)
        try:
            fcntl.lockf(lockpyfd, fcntl.LOCK_EX | fcntl.LOCK_NB)
            # Wrap the current progress with the server sender
            self.progress = ServerProgress(self.progress)
            return True
        except IOError, e:
            if e.errno == errno.EACCES or e.errno == errno.EAGAIN:
                return False
            else:
                raise

Since no reference is kept to lockfd, the lock expires when the garbage
collector decides it.

I'll now fix that instead of applying your patch. I hope you don't mind
:)


Ciao,

Enrico

-- 
GPG key: 4096R/E7AD5568 2009-05-08 Enrico Zini <enr...@enricozini.org>

Attachment: signature.asc
Description: Digital signature

Reply via email to