https://bugs.openldap.org/show_bug.cgi?id=9378
--- Comment #26 from stefan.bruens@rwth-aachen.de --- (In reply to Howard Chu from comment #25)
(In reply to stefan.bruens from comment #22)
Is there any way to query at runtime if the env uses robust mutexes? (Runtime is required, as we liblmdb is dynamically linked.)
No. Nor is there any reason to query this, since the application shouldn't care either way. Especially for programs like baloo_file, which start up periodically, do some work, and then exit - the lockfile becomes irrelevant when the last process opening the env closes it, so any potentially stale locks go away by themselves anyway.
Your understanding here seems to be quite incorrect. baloo_file is started with the session, and keeps running until the session ends. Only the extractor process is spawned on demand.
Taken from http://www.lmdb.tech/doc/index.html
- Windows - automatic
- Linux, systems using POSIX mutexes with Robust option - automatic
- not on BSD, systems using POSIX semaphores. Otherwise just make all programs using the database close it; the lockfile is always reset on first open of the environment.
Note the third bullet point - there apparently *is* special handling required for these systems. "Otherwise just make all programs using the database close it;".
There may be many processes which also read the DB, and there is also another helper process which runs for the whole session duration. Other processes (e.g. dolphin) also keep the env open while the process is running. These process open read transactions just for very short durations, but nevertheless may crash (last but not least because some users think it is a good idea to SIGKILL random processes). Btw, apparently there is no API to query stale readers in a programmatically useful way, and not way to query active readers at all.
Also, the Caveat only became clear when it was actually written (and obviously there was a need for it), and depending on where you got the documentation from (Homepage or header file from the distribution) it may have just been missing. Or it has been overlooked, because it is not linked from the mdb_env_open API documentation. No reason to call anyone stupid here ...