From 29efe24ab1cf7e29f35a2d6e6dabe58e18e7c74f 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 7216a6951..55fff06fb 100644 --- a/walletdb/bdb/db.go +++ b/walletdb/bdb/db.go @@ -291,6 +291,7 @@ func (ns *namespace) Begin(writable bool) (walletdb.Tx, error) { bucket := boltTx.Bucket(ns.key) if bucket == nil { + boltTx.Rollback() return nil, walletdb.ErrBucketNotFound }