HomePhabricator

wallet: Reset BerkeleyDB handle after connection fails

Description

wallet: Reset BerkeleyDB handle after connection fails

Summary:

According to the BerkeleyDB docs, the DbEnv handle may not be accessed
after close() has been called. This change ensures that we create a new
handle after close() is called. This avoids a segfault when the first
connection attempt fails and then a second connection attempt tries to
call open() on the already closed DbEnv handle.

Backport of core PR13161.

Test Plan:

ninja check
./test/functional/test_runner.py feature_dbcrash

Reviewers: #bitcoin_abc, deadalnix

Reviewed By: #bitcoin_abc, deadalnix

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

Details

Provenance
Tim Ruffing <crypto@timruffing.de>Authored on May 3 2018, 15:45
FabienCommitted on Jan 10 2020, 16:04
jasonbcoxPushed on Jan 10 2020, 19:30
Reviewer
Restricted Project
Differential Revision
D4883: wallet: Reset BerkeleyDB handle after connection fails
Parents
rSTAGING08f879687543: Use best-fit strategy in Arena, now O(log(n)) instead O(n)
Branches
Unknown
Tags
Unknown