From d2c851431ba5bffa32cf806e76ba9ca4b5043e5d Mon Sep 17 00:00:00 2001 From: Josh Rickmar Date: Tue, 5 Apr 2016 11:46:42 -0400 Subject: [PATCH] Rollback namespace transactions when bucket is not found. This fixes a deadlock where failed transactions due to the namespaces' bucket being missing would cause deadlocks due to bolt's mmap rwmutex still being read or write locked (and no way to unlock it, since the underlying bolt tx was not returned on failure). --- walletdb/bdb/db.go | 1 + 1 file changed, 1 insertion(+) diff --git a/walletdb/bdb/db.go b/walletdb/bdb/db.go index 8fabe22..041737d 100644 --- a/walletdb/bdb/db.go +++ b/walletdb/bdb/db.go @@ -290,6 +290,7 @@ func (ns *namespace) Begin(writable bool) (walletdb.Tx, error) { bucket := boltTx.Bucket(ns.key) if bucket == nil { + boltTx.Rollback() return nil, walletdb.ErrBucketNotFound }