Skip to content

Lockfile system in acsInstanceLock #51

@rcastill

Description

@rcastill

acsInstanceLock uses AcsutilPy.AcsInstanceLockHelper.AcsInstanceLockHelper as backend, in which I've found some issues:

  1. lock(self, instance) method makes use of lockfile unix command ( call(["lockfile","-r-0",lockFileName])). The system I'm testing ACS on (CentOS 6.7), lockfile utility is provided under the name of lockfile-create within the lockfile-progs suite. That causes problems when trying to use acsStart and acsStop ACS commands.
  2. AcsInstanceLockHelper defines '.lock' suffix for the lock's name generated by __buildLockFileName(self, instance). The "problem" here is that lockfile (or lockfile suite for that matter) already adds '.lock' suffix to the name unless -l option is passed as parameter. So for example, if we are working on ACS_INSTACE=0, the generated name would be acsInstance0.lock.lock; this is inconvenient for unlock(self, instance) method, since it uses rm to remove the lockfile.
    Possible solution: remove suffix definition in AcsInstanceLockHelper and use lockfile-remove utility from lockfile-progs suite instead of rm to unlock.

For completeness I attach the error when lockfile command is missing (Note at the end there is an inaccurate definition of the error):

ip177 root:/opt/alma/ACS-2015.4 1021 > acsStart -v Locking instance 0 with lock file /opt/alma/ACS-2015.4/acsdata/tmp/acsInstance0.lock Traceback (most recent call last): File "/opt/alma/ACS-2015.4/ACSSW/bin/acsInstanceLock", line 87, in <module> ret=lockHelper.checkAndLock() File "/opt/alma/ACS-2015.4/ACSSW/lib/python/site-packages/AcsutilPy/AcsInstanceLockHelper.py", line 176, in checkAndLock ret = self.lock(int(self.__instanceEnvVar)) File "/opt/alma/ACS-2015.4/ACSSW/lib/python/site-packages/AcsutilPy/AcsInstanceLockHelper.py", line 114, in lock return call(["lockfile","-r-0",lockFileName]) File "/usr/lib64/python2.6/subprocess.py", line 478, in call p = Popen(*popenargs, **kwargs) File "/usr/lib64/python2.6/subprocess.py", line 642, in __init__ errread, errwrite) File "/usr/lib64/python2.6/subprocess.py", line 1238, in _execute_child raise child_exception OSError: [Errno 2] No such file or directory 2016-06-14T23:44:03.728 ERROR [acsStart] Unable to continue as there is already a lock file for ACS_INSTANCE 0 in /opt/alma/ACS-2015.4/acsdata/tmp!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions