[Date Prev][Date Next] [Chronological] [Thread] [Top]

(ITS#8339) LMDB robust mutex fix



Full_Name: Rolf Stalder
Version: 2.4.43
OS: Solaris 11.2
URL: https://www.gulag.ch/www/download/0001-Solaris-robust-mutex-fix.patch
Submission from: (NULL) (217.162.126.5)


The provided patch (against 2.4.43) might solve a problem with the new robust
POSIX mutex implementation of LMDB 0.9.17 on Solaris 10/11.x. On Solaris 11
slapd fails to open the database:

--
mdb_db_open: database "x": dbenv_open(y).
mdb_db_open: database "x" cannot be opened: z (N). Restore from backup!
backend_startup_one (type=mdb, suffix="x"): bi_db_open failed! (N)
slapd shutdown: initiated
--
Values of 16 (EBUSY) and 22 (EINVAL) have been observed for N.

The following notes can be found in pthread_mutexattr_setrobust(3C) (
https://docs.oracle.com/cd/E36784_01/html/E36874/pthread-mutexattr-setrobust-3c.
html
):

--
The mutex memory must be zeroed before first  initialization
of  a  mutex  with  the  PTHREAD_MUTEX_ROBUST attribute. Any
thread in any process interested in the robust lock can call
pthread_mutex_init()  to potentially initialize it, provided
that all such callers of  pthread_mutex_init()  specify  the
same  set  of  attributes  in their attribute structures. In
this situation, if pthread_mutex_init() is called on a  pre-
viously  initialized  robust mutex, it will not reinitialize
the  mutex  and  will  return  the  error  value  EBUSY.  If
pthread_mutex_init()  is  called on a previously initialized
robust mutex, and if the caller specifies a different set of
attributes  from  those  already in effect for the mutex, it
will not reinitialize the mutex and will  return  the  error
value EINVAL.
--

Solaris 10 only provides the *_np functions (2.4.43 build/compilation fails
altogether) but the above meaning of EBUSY/EINVAL applies as well.

This patch has only be tested on Solaris 10/11.2 with Solaris Studio 12.3.