[Sugar-devel] "Another osbuild instance is running" error
quozl at laptop.org
Thu Dec 31 15:10:50 EST 2015
On Thu, Dec 31, 2015 at 11:26:26PM +0530, Shraddha Barke wrote:
> On Thu, 31 Dec 2015, James Cameron wrote:
> >On Thu, Dec 31, 2015 at 03:38:02AM +0530, Shraddha Barke wrote:
> >>>On Wed, Dec 30, 2015 at 04:30:17AM +0530, Shraddha Barke wrote:
> >>>>I am trying to build sugar on Ubuntu 15.04 laptop. After git clone
> >>>>and cd into sugar-build I get this error-Another osbuild instance is
> >>>>running on executing ./osbuild pull
> >>>>I searched the internet and found 2 such threads but the issue wasn't
> >>>There's more than two such threads on sugar-devel at .
> >>>>Is this a bug that needs fixing?
> >>>Yes, it's a bug in osbuild, please fix it.
> Hello James,
> I made the following changes in check_lock()
> def check_lock():
> - try:
> - fcntl.lockf(get_lock_file(), fcntl.LOCK_EX | fcntl.LOCK_NB)
> - except IOError:
> - return False
> - return True
> + pid = os.getpid()
> + try:
> + fcntl.lockf(pid, fcntl.LOCK_EX | fcntl.LOCK_NB)
> + except IOError:
> + return False
> + try:
> + os.kill(pid(), 0)
> + except OSError:
> + return False
> + return True
Ah, that's not what I meant.
But I was wrong to suggest a redesign using getpid and kill, because
my analysis of the code _today_ shows the underlying cause must be
something other than locking.
Let me explain.
check_lock does try fcntl.lock, and if an exception IOError occurs,
does return False.
But inside the same try clause is a call to get_lock_file. Therefore
any IOError inside get_lock_file will also cause check_lock to return
A possible error is that the file could not be opened for write,
e.g. because it is owned by someone else, or the protection mask
(chmod) is wrong, or the directory does not exist, or the directory is
lock_file = get_lock_file()
fcntl.lockf(lock_file, fcntl.LOCK_EX | fcntl.LOCK_NB)
As a result of this change, any problem opening and writing to the
file will be reported before the "another instance" error.
> so that when there is no process running false is returned. However it is
> not fixing the bug.
> And yeah when I try to delete the lock file, I get 'file or
> directory doesn't exist'
That's not possible to explain given the data you sent.
You said the print statement showed the file path as
Presumably ... is something like /home/username
Does the .lock-host file still exist?
Show me "stat .lock-host"?
If the file exists, but you cannot delete it, then osbuild will fail
to open it for write.
> Sorry for the novice questions :(
When you see me say something that doesn't match what you see, please
be sure to tell me about it!
> Kind Regards,
> >James Cameron
More information about the Sugar-devel