buntdb icon indicating copy to clipboard operation
buntdb copied to clipboard

Noticed Deadlock? Sometimes buntdb gets stuck by a deadlock

Open ibudisteanu opened this issue 3 years ago • 3 comments

Hi. Today, I decided to integrate buntdb via interfaces ( alongside boltdb ) as both libraries are very similar. When running the same code using buntdb, sometimes it generates a deadlock and gets stuck (probably the locking mechanism of buntdb). I want to say that I am running the same exact code using boltdb and I never noticed any deadlock using boltdb.

You can check both databases integrations via an interface https://github.com/PandoraPay/go-pandora-pay/tree/main/store/store-db

LE: Could it be because the string -> []byte cast? As keys and values are binary data casted as strings? LE2: Tested it again. Buntdb generates deadlock. Same code running with boltdb no deadlock spotted.

ibudisteanu avatar May 25 '21 21:05 ibudisteanu

Hi. I would like to reproduce this issue. Could you provide the steps to cause the deadlock?

tidwall avatar Jun 01 '21 00:06 tidwall

Hi @tidwall ! Thanks for the response. I will make you a tutorial tomorrow to reproduce it after I will test it again. Thanks again!

ibudisteanu avatar Jun 01 '21 00:06 ibudisteanu

Today, I also noticed a deadlock. I was starting a read / write transaction (update) enclosed within a read-only transaction (view). Silly me running untested code.

Stumbled across this issue and thought this info might be interesting for other users. Cheers!

gohumble avatar Jun 04 '21 18:06 gohumble