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

(ITS#8089) LMDB hangs on mdb_txn_renew0 if MDB_NOSYNC flag is used

Full_Name: Pavel Kraynyukhov
Version: only LMDB from git and lmdb-0.9.14
OS: Gentoo Linux
URL: ftp://ftp.openldap.org/incoming/
Submission from: (NULL) (

Hello there, I have ran into an issue with LMDB, which I can reproduce at will,
but it seems a specific one. The git commit is
And this commit and my issue seems to be related. 

1. I use MDB_NOTLS flag on environment open.
2. if  I use MDB_NOSYNC flag for LMDB environment, the writer thread is stuck
after several transactions (writer thread backtrace):

#0  0x00007fe5534a25dc in __lll_robust_lock_wait () from /lib64/libpthread.so.0
#1  0x00007fe553498ba1 in __pthread_mutex_lock_full () from
#2  0x00007fe553ed895a in mdb_txn_renew0 (txn=txn@entry=0x661810) at mdb.c:2638
#3  0x00007fe553ed9558 in mdb_txn_begin (env=0x6606c0, parent=0x0,
flags=<optimized out>, ret=0x7fe552bebd08) at mdb.c:2813
#4  0x000000000041cd0c in beginWOTxn (parent=0x0, this=0x6603a8) at
#5  itc::lmdb::WOTxn::WOTxn (this=0x7fe552bebdb0, ref=...) at
#6  0x0000000000420c5b in itc::lmdb::DBWriter::dbWrite
(this=this@entry=0x661b08) at ../ITCFramework/include/LMDBWriter.h:185
#7  0x00000000004210ff in itc::lmdb::DBWriter::execute (this=0x661b08) at
#8  0x0000000000414eac in itc::sys::CancelableThread<itc::lmdb::DBWriter>::run
(this=0x7ffff31f7cd0) at ../ITCLib/include/sys/CancelableThread.h:84
#9  0x0000000000439dc4 in itc::sys::invoke (context=0x7ffff31f7cd0) at
#10 0x00007fe55349b4c6 in start_thread () from /lib64/libpthread.so.0
#11 0x00007fe5531e000d in clone () from /lib64/libc.so.6

Before you might ask:
1. There is only one writer thread. Only this thread begins writable
transactions and only this thread commits them and of course only this thread
calls mdb_put().
2. There suppose to be a multiple reader threads. For the test I'm running one
only. And there are no read operations or cursor usage during this test at the
same time when the writer is working.
3. When I write hang, I mean only the application not the system. The test
application consume no CPU after it hang. 
4. If no MDB_NOSYNC flag is used, then there is no bug/deadlock. This however
may be due to very slow file system operations of my PC. It is about 35 writable
transactions per second and about 27-39% I/O wait on the CPU. 

P.S. tested against system provided lmdb version 0.9.14 and result is the same.
So this maybe not related to latest commit in git.