[Date Prev][Date Next]
[Chronological]
[Thread]
[Top]
Re: mdb broken under OpenBSD
On Thu, Aug 03, 2017 at 02:20:29PM -0700, Paul B. Henson wrote:
> From my initial look, mdb_env_create() successfully sets mdb->mi_dbenv,
> it's still valid in mdb_db_open(), but by the time it reaches
> be->be_entry_put in slapadd() it's NULL :(.
It turned out it was only sometimes NULL. The culprit was actually the local
OpenBSD patch that was added to mdb_db_open() to ensure MDB_WRITEMAP is always
set:
if ( !(flags & MDB_WRITEMAP) ) {
Debug( LDAP_DEBUG_ANY,
LDAP_XSTRING(mdb_db_open) ": database \"%s\" does not have writemap. "
"This is required on systems without unified buffer cache.\n",
be->be_suffix[0].bv_val, rc, 0 );
goto fail;
}
There were two problems with it; first, it accesses the local flags variable
before it is initialized to mdb->mi_dbenv_flags shortly thereafter, so
the value is random and the if block nondeterministically triggers, and
second, it doesn't assign a failure value to rc before it jumps to fail:,
so the function returns successfully but with a closed be.
mdb has been disabled for a while, so I'm guessing the first issue might
have occurred over time as backend.c changed and the patch was just
blindly updated without testing. The second issue I'm not sure about.
I temporarily tweaked it to always enable MDB_WRITEMAP so I could run the
mdb test suite (which doesn't have it enabled for everything) and so far
it seems to be working.
I would hope that this simple issue isn't why they've had it disabled all
this time, but I guess I'll see what happens with the full test suite
as it progresses.