[Date Prev][Date Next]
(ITS#7896) macos issue with mdb_env_map
OS: MacOS 10.9.4
Submission from: (NULL) (22.214.171.124)
Under MacOS I have compiled lmdb 0.9.14, and I've found that anything using it
reports resources unavailable the second time they try to use a database - this
includes the test scripts. Make test output ends with:
key: 0x10ead7e7c 199 , data: 0x10ead7e80 199 409 foo bar
mdb_env_open failed, error 16 Resource busy
make: *** [test] Error 1
I tracked down the problem to mdb.c, mdb_env_map function, line 3714.
/* Can happen because the address argument to mmap() is just a
* hint. mmap() can pick another, e.g. if the range is in use.
* The MAP_FIXED flag would prevent that, but then mmap could
* instead unmap existing pages to make room for the new map.
if (addr && env->me_map != addr)
return EBUSY; /* TODO: Make a new MDB_* error code? */
This expression always evaluates to true when opening an existing database, even
with mdb_env_open is called without the MDB_FIXEDMAP flag, so the open always
If I commend that check out and rerun make test, it succeeds:
key: 0x103580f84 240 , data: 0x103580f88 240 576 foo bar
Status of Main DB
Tree depth: 2
Branch pages: 1
Leaf pages: 3
Overflow pages: 0
My guess is that this is macos related or someone would have found it before me.
Git blame shows this portion of the code hasn't changed in almost a year.
However other parts of the same function have changed within the last year, so
this could be a result of a recent change.