HomePhabricator

rpc: Make unloadwallet wait for complete wallet unload

Description

rpc: Make unloadwallet wait for complete wallet unload

Summary:

Currently the unloadwallet RPC is asynchronous, it only signals the
intent to unload the wallet and then returns the response to the client.
The actual unload can happen later and the client has no way to be
notified of that.

This PR makes the unloadwallet RPC synchronous, meaning that it blocks
until the wallet is fully unloaded.

This is expected to fix wallet_multiwallet.py failure with TSAN.
Also include an undefined behavior issue, where the wallet pointer
is used after freed (see https://github.com/bitcoin/bitcoin/issues/16668).

Backport of PR14941 and PR16716.

Depends on D5079.

Test Plan:

ninja check check-functional

Run the CI build-tsan configuration several times, check that the
wallet_multiwallet failure has gone.

Reviewers: #bitcoin_abc, jasonbcox, deadalnix

Reviewed By: #bitcoin_abc, jasonbcox, deadalnix

Subscribers: deadalnix

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

Details

Provenance
João Barbosa <joao.paulo.barbosa@gmail.com>Authored on Dec 12 2018, 23:21
FabienCommitted on Jan 30 2020, 08:49
markblundebergPushed on Jan 30 2020, 10:46
Reviewer
Restricted Project
Differential Revision
D5080: rpc: Make unloadwallet wait for complete wallet unload
Parents
rSTAGINGa620b73315c5: [SECP256K1] CMake: add an install target
Branches
Unknown
Tags
Unknown
References
tag: phabricator/base/15907, tag: phabricator/base/15905, tag: phabricator/base/15898, tag: phabricator/base/15887