Any experiences with LockFile::Simple module?

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View


for handling concurrency related issues i wanted to hear about
experiences of others using the LockFile::Simple (or similar modules)
especially if they ran into problems using the module.

please let me know.


Re: Any experiences with LockFile::Simple module?

I do not have that specific module, but I do have some strong ideas
about locking and synchronization.

If the module creates a file, and relies on the locking process to
unlock/remove it, then I wouldn't use it.

The problem is that if your application dies, either core-dumps, or
gets killed externally, or even killed by your own code *and you forgot
to remove the lockfile*, then everybody thinks that the locking program
is still using it. Which is false.

What you need is a mechanism that insures that the lock is removed the
same time a process is killed. The only way I see that happening is not
in the code, but in the Operating System.

I would use a kernel semaphore, or a socket for example.

Re: Any experiences with LockFile::Simple module?

good analysis.

that is why, we want to wrap LockFile::Simple around to provide
stuff like auto-magic lock removals when signals like HUP, TERM, QUIT
are recieved. so that problem of left-over locks should be less painful
that way.

the problem with semaphores etc is with the portability etc; not all
support the same semaphore capabilities etc. from that respect, the
strategy of LockFile::Simple would be attractive...


Site Timeline