ispCP - Board - Support
Lock file not removed - Printable Version

+- ispCP - Board - Support (http://www.isp-control.net/forum)
+-- Forum: ispCP Omega Development Area (/forum-1.html)
+--- Forum: General discussion (/forum-11.html)
+--- Thread: Lock file not removed (/thread-7803.html)



Lock file not removed - aseques - 09-08-2009 10:55 PM

Hello, I am trying to develop an script to manage some domains. I'm facing a probem with the lock file.
With version 1.0.0 the lock file (in /var/run/ispcp.lock) is removed when the system stops the processes.
After upgrading to 1.0.3 (from trunk) the lock is never removed.
I've been looking and couldn't find the process that removes it, I suppose that it should be the same that launces the domain/mailbox/etc.. creation.

Thanks


RE: Lock file not removed - kilburn - 09-08-2009 11:08 PM

I changed the locking code because it was faulty (had race condition bugs). In current versions, the lockfile donesn't need to be removed, so this is not a problem.

Have you observed anything not working because of this?


RE: Lock file not removed - aseques - 09-09-2009 12:30 AM

(09-08-2009 11:08 PM)kilburn Wrote:  I changed the locking code because it was faulty (had race condition bugs). In current versions, the lockfile donesn't need to be removed, so this is not a problem.

Have you observed anything not working because of this?

No, but I was trying to develop some scripts to create a domain, etc. from command line, and since I was checking the non-existance of the lock to start, now it doesn't work.

If you are keeping the lock all the time, what's the recommended way of either lock or know that the system is working.
Or now I can simply create the entries all the time?


RE: Lock file not removed - kilburn - 09-09-2009 01:20 AM

Quote:Or now I can simply create the entries all the time?
No, you can't.

Quote:If you are keeping the lock all the time, what's the recommended way of either lock or know that the system is working.
The software uses "flock" on this file now. Basically, you first have to open the file and then call "flock(filehandle, LOCK_EX)" to obtain an exclusive lock on it. Read the "flock" documentation, where you'll see examples of both blocking (what the engine uses, to wait until it can operate) and non-blocking calls (maybe you want to use this, so if you can't get the lock immediately an error is returned to the user).

My commit message regarding the changes gives further insights on the issue if you're interested.