[Date Prev][Date Next]
[Chronological]
[Thread]
[Top]
Antw: LMDB: Robust mutexes and platform detection
>>> Kristian Amlie <kristian.amlie@cfengine.com> schrieb am 28.07.2014 um 13:06 in
Nachricht <53D62EB5.5090405@cfengine.com>:
> Hey,
>
> In CFEngine's custom version of LMDB we have started using the
> pthread_mutexattr_setrobust interface in order to recover from the
> deadlock that can occur if a process is killed while holding the writer
> lock on LMDB. If a different process is waiting for the same lock at
> that time, it will wait forever, but with the robustness attribute, the
> attempted lock will return with an error instead.
>
> I think this would be a useful feature to have in LMDB in general, since
> you can always risk a deadlock if there are at least two processes and
> one of them receives SIGKILL. It requires using the attribute and a
> little bit of extra error handling inside the part of LMDB where locking
> is done.
>
> One complication is that the interface is not available everywhere,
> particularly the commercial Unixes and older Linux releases. In CFEngine
> we have solved this by replacing the Makefile that LMDB comes with, with
> a set of autotools files which can handle platform detection for us.
You are right: For SLES11 SP3 I get:
man -k pthread_mutexattr_set
pthread_mutexattr_setprioceiling (3p) - get and set the prioceiling attribute...
pthread_mutexattr_setprotocol (3p) - get and set the protocol attribute of th...
pthread_mutexattr_setpshared (3p) - get and set the process-shared attribute
pthread_mutexattr_settype (3p) - get and set the mutex type attribute
>
> Robust mutexes have been briefly discussed before on the mailing list,
> but it seems that no action was taken at that time. I hope this is
> interesting to the LMDB community, and we'd like to work with you to get
> the patches accepted.
>
> I have attached the current versions of the patches we use. They will
> definitely need to be adapted before they can be applied in the openldap
> repository, for one thing they are made against LMDB 0.9.9, but they are
> enough to get the idea.
>
> --
> Kristian Amlie
> Software Engineer
> CFEngine