Page MenuHomePhabricator

Free BerkeleyEnvironment instances when not in use
ClosedPublic

Authored by Fabien on Jan 10 2020, 21:21.

Details

Summary
Instead of adding BerkeleyEnvironment objects permanently to the
g_dbenvs map, use reference counted shared pointers and remove map
entries when the
last BerkeleyEnvironment reference goes out of scope.

Backport of core PR11911 and PR15322:
https://github.com/bitcoin/bitcoin/pull/11911/files
https://github.com/bitcoin/bitcoin/pull/15322/files

This should fix ASAN and TSAN.

Depends on D4888.

Test Plan
ninja all check
./test/functional/test_runner.py wallet_*

ABC_BUILD_NAME=build-asan ./contrib/teamcity/build-configurations.sh
ABC_BUILD_NAME=build-tsan ./contrib/teamcity/build-configurations.sh

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

jasonbcox requested changes to this revision.Jan 10 2020, 22:36
jasonbcox added a subscriber: jasonbcox.

Everything looks good except for the one missed line in the comment.

src/wallet/db.cpp
62 ↗(On Diff #15315)

s/ open//g

This revision now requires changes to proceed.Jan 10 2020, 22:36
src/wallet/db.cpp
62 ↗(On Diff #15315)

Good catch !

deadalnix added inline comments.
contrib/teamcity/build-configurations.sh
76 ↗(On Diff #15327)

likestamp

108 ↗(On Diff #15327)

likestamp

This revision is now accepted and ready to land.Jan 11 2020, 16:50