HomePhabricator

Free BerkeleyEnvironment instances when not in use

Description

Free BerkeleyEnvironment instances when not in use

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

Reviewers: #bitcoin_abc, deadalnix, jasonbcox

Reviewed By: #bitcoin_abc, deadalnix, jasonbcox

Subscribers: jasonbcox

Differential Revision: https://reviews.bitcoinabc.org/D4891

Details

Provenance
Russell Yanofsky <russ@yanofsky.org>Authored on May 18 2018, 20:28
FabienCommitted on Jan 13 2020, 07:13
FabienPushed on Jan 13 2020, 07:13
Reviewer
Restricted Project
Differential Revision
D4891: Free BerkeleyEnvironment instances when not in use
Parents
rABC82fe6a22e7ce: Fix the abc-p2p-compactblocks when running whith UBSAN
Branches
Unknown
Tags
Unknown