Page MenuHomePhabricator

Free BerkeleyEnvironment instances when not in use
ClosedPublic

Authored by Fabien on Fri, Jan 10, 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

Fabien created this revision.Fri, Jan 10, 21:21
Herald added a reviewer: Restricted Project. · View Herald TranscriptFri, Jan 10, 21:21
jasonbcox requested changes to this revision.Fri, Jan 10, 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.Fri, Jan 10, 22:36
Fabien added inline comments.Sat, Jan 11, 05:58
src/wallet/db.cpp
62 ↗(On Diff #15315)

Good catch !

Fabien updated this revision to Diff 15327.Sat, Jan 11, 05:58

Fix comment.

deadalnix accepted this revision.Sat, Jan 11, 13:11
deadalnix added inline comments.
contrib/teamcity/build-configurations.sh
76 ↗(On Diff #15327)

likestamp

108 ↗(On Diff #15327)

likestamp

jasonbcox accepted this revision.Sat, Jan 11, 16:50
This revision is now accepted and ready to land.Sat, Jan 11, 16:50
This revision was automatically updated to reflect the committed changes.