[BUG]: os.Exit on datastore close from block.ref going bellow zero
fredcarle opened this issue · comments
What version of Badger are you using?
v4.1.0
What version of Go are you using?
1.20
Have you tried reproducing the issue with the latest release?
Yes
What is the hardware spec (RAM, CPU, OS)?
16GB, M1, macOS
What steps will reproduce the bug?
We are using Badger as the datastore for DefraDB and while doing integration test and running our change detector, we run tests from both our develop branch and PR branch. The develop tests each use a unique set of Badger storage files but those files are then reused for the same test in the PR branch. This means that we close the Badger instance in after the tests in develop and run it again in the PR branch. On that second close, we often get an asset Failure on close because the block.decrRef
method tries to decrease the reference even though it's already zero. https://github.com/sourcenetwork/defradb/actions/runs/5628956063/job/15253408371
Expected behavior and actual result.
We expect the badger datastore to close without error.
Additional information
No response