]> git.sur5r.net Git - openldap/commitdiff
ITS#7970 LMDB: Critical Heisenbug
authorleo@yuriev.ru <leo@yuriev.ru>
Fri, 17 Oct 2014 22:35:41 +0000 (22:35 +0000)
committerHallvard Furuseth <hallvard@openldap.org>
Wed, 14 Jan 2015 18:24:18 +0000 (19:24 +0100)
Inconsistent reading & SIGSEGV due to the race condition.

libraries/liblmdb/mdb.c

index 89d4a2a2575b1382e77b91939fabf1fede783c86..27dbb9b1ae5857160441681b9de357395b804170 100644 (file)
@@ -2539,7 +2539,10 @@ mdb_txn_renew0(MDB_txn *txn)
                                        return rc;
                                }
                        }
-                       txn->mt_txnid = r->mr_txnid = ti->mti_txnid;
+                       do /* LY: Retry on a race, ITS#7970. */
+                               r->mr_txnid = ti->mti_txnid;
+                       while(r->mr_txnid != ti->mti_txnid);
+                       txn->mt_txnid = r->mr_txnid;
                        txn->mt_u.reader = r;
                        meta = env->me_metas[txn->mt_txnid & 1];
                }