[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: stale lock files



Brian May <bam@debian.org> writes:

> Hello,
>
> I have noticed GUI programs tend to be very inconsistent in behaviour
> if I accidently kill them (e.g. by shutting down the X server) or
> abort them (e.g. power failure).
>
> For example:
>
> gnucash (not tested newest version):
>
> * displays a message box saying the file is locked, and asks if you
> want to continue anyway.
>
> * liferea: displays an error and terminates; the lock file must be
> manually deleted.
>
> * mozilla - occasionally will display a message that the profile is in
> use, and won't let you reuse it until you delete the lock file. I am
> not sure what triggers this condition.
>
>
> In this era of making computers easier to use, forcing the user to
> worry about cleaning up lock files like this seems very clumsy at
> best, and can also be unreliable (e.g. I sometimes already do have a
> copy of gnucash running, but I can't find it in the maze of windows,
> and delete the lock file :-( ).
>
>
> Is there any guidelines for checking for stale lock files in a sane
> manner that doesn't involve the user?
>
> Yes, I realize having a home directory on NFS or AFS or SMB might be
> complications, but most users of these applications don't use these
> protocols either.
>
> Thanks.
> -- 
> Brian May <bam@debian.org>

Write the pid and host to the lock file. When you detect a lock and
the lock is on the local host then check the pid is still valid. If
not the lock is stale. If the lock is from a remote host there is
little you can do but ask.

MfG
        Goswin



Reply to: