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

[LMDB] Lockups with robust mutexes and crashing processes



        I already posted this to the IRC channel, but there was no response, so I repost this here.

        I'm trying out lmdb from master, including the robust mutex code. We're experiencing lock ups after the process holding the lock dies, as if the robust lock was not recovered. I tried to come up with an lmdb example that shows it and I got it, just a few lines. It uses fork() just to automate it; see that the environment is opened in both children. Here's the code:

http://pastebin.com/Cbbri6az

        If I run this, I see that one of the children waits for the write lock and is not awakened when the other child dies without closing the txn (but notice I close the env). This is on purpose, to simulate a crashing process.The worst part is that I can't reproduce it using directly libpthread and mmap. Here is the code I came up with:

http://pastebin.com/ybR5L4cP

        It's a little bit more verbose because I based it on a glibc test case.

        Are we missing anything? It seems to us that the code follows does not break any of LMDB's caveats (specially the one about creating the envs before fork()'ing. Is it wrong to assume that the waiting process should recover the lock from staleness?

--
Marcos Dione
Astek Sud-Est
R&D-SSP-DTA-TAE-TDS
for Amadeus SAS
T: +33 (4)4 9704 1727
marcos-david.dione@amadeus.com