Current time: 12-26-2024, 11:15 AM Hello There, Guest! (LoginRegister)


Post Reply 
Lock file not removed
Author Message
aseques Offline
Member
*****
Dev Team

Posts: 330
Joined: May 2008
Reputation: 4
Post: #1
Lock file not removed
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
09-08-2009 10:55 PM
Find all posts by this user Quote this message in a reply
kilburn Offline
Development Team
*****
Dev Team

Posts: 2,182
Joined: Feb 2007
Reputation: 34
Post: #2
RE: Lock file not removed
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?
09-08-2009 11:08 PM
Visit this user's website Find all posts by this user Quote this message in a reply
aseques Offline
Member
*****
Dev Team

Posts: 330
Joined: May 2008
Reputation: 4
Post: #3
RE: Lock file not removed
(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?
09-09-2009 12:30 AM
Find all posts by this user Quote this message in a reply
kilburn Offline
Development Team
*****
Dev Team

Posts: 2,182
Joined: Feb 2007
Reputation: 34
Post: #4
RE: Lock file not removed
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.
09-09-2009 01:20 AM
Visit this user's website Find all posts by this user Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 1 Guest(s)