Re: [documancer] Failed to lock the lock file
Status: Beta
Brought to you by:
vaclavslavik
From: Arnd B. <arn...@we...> - 2004-02-06 09:16:10
|
On Thu, 5 Feb 2004, Vaclav Slavik wrote: [...] > I have no idea what do it with it. Maybe try if a small C or Python > app that uses advisory locks works (i.e. if it is specific to > wxWindows). Great - every time I have correspondence with you I learn (or have to ;-) something new. Alright, here we go: The small python example below works fine on my local machine. However, on the machine with the NFS mount stuff I get python lock_test.py Traceback (most recent call last): File "lock_test.py", line 26, in ? fcntl.flock(file.fileno(),fcntl.LOCK_SH) IOError: [Errno 37] No locks available That looks pretty much like the message I got when running documancer. Well, I according to the sysadmin I thought locking is possible, but maybe it is not or I am doing something wrong. In any case I think that even if I am able to resolve this locally (which I have some doubts right now), the problem may in general occur for other users as well. BTW: wouldn't a normal file just serve the same purpose of saying "There is already a documancer instance running" ? (But presumably I am missing something ...) Best, Arnd ###################################### """ If the lock_file exists: exit Otherwise: create lock_file and wait 10s. To test this: start this script and within the 10s try to start this again. According to the Python CookBook, 4.24, p. 152ff this is not cross-platform. (E.g. on Windows one has to use win32all) """ import os import sys import fcntl import time lock_file="test_lock_file.lock" if os.path.exists(lock_file): print os.path.exists("test_lock_file.lock") print "Lock file exists - exiting" sys.exit(0) file=open(lock_file,"w") fcntl.flock(file.fileno(),fcntl.LOCK_SH) print "Wait a while..." time.sleep(10) fcntl.flock(file.fileno(),fcntl.LOCK_UN) file.close() os.remove(lock_file) ################### EOF |