Nick Wellnhofer wrote on 2/15/17 7:42 AM:
Lucifers,
I had a close look at Lucy's locking code and while I didn't find any glaring
problems, I think it could be improved in some places. First of all, I'd like to
use a locking mechanism provided by the OS instead of rolling our own. The main
upside is that we can detect reliably whether a process holding a lock has
crashed without relying on a heuristic.
Not to dissuade you from rewriting all the locking logic, since Marvin has given
his far more insightful accounting on that topic, but I wonder if there is a
simpler way to solve the problem you raise: detecting reliably whether a process
holding a lock has crashed.
https://metacpan.org/pod/Path::Class::File::Lockable is how I have approached
that in my Perl code, by writing the PID to the lock file, and then checking if
the PID is still alive when I encounter the lock later.
https://github.com/publicinsightnetwork/audience-insight-repository/blob/master/bin/indexer#L121
e.g.
We already write the PID to Lucy lock files, so we can check if the process that
created the lock is still running, yes?
Or is that the very heuristic that you're wanting to move away from?
--
Peter Karman . https://peknet.com/ . https://keybase.io/peterkarman