Compare commits

..

5 commits

Author SHA1 Message Date
Ryan Ofsky
5b38e62ccb ipc: Handle bitcoin-wallet disconnections
This fixes an error reported by Antoine Poinsot <darosior@protonmail.com> in
https://github.com/bitcoin-core/libmultiprocess/issues/123 that does not happen
in master, but does happen with https://github.com/bitcoin/bitcoin/pull/10102
applied, where if the child bitcoin-wallet process is killed (either by an
external signal or by Ctrl-C as reported in the issue) the bitcoin-node process
will not shutdown cleanly after that because chain client flush()
calls will fail.

This change fixes the problem by handling ipc::Exception errors thrown during
the flush() calls, and it relies on the fixes to disconnect detection
implemented in https://github.com/bitcoin-core/libmultiprocess/pull/160 to work
effectively.
2025-04-24 15:20:58 -04:00
Ryan Ofsky
db845b915f ipc: Add Ctrl-C handler for spawned subprocesses
This fixes an error reported by Antoine Poinsot <darosior@protonmail.com> in
https://github.com/bitcoin-core/libmultiprocess/issues/123 that does not happen
in master, but does happen with https://github.com/bitcoin/bitcoin/pull/10102
applied, where if Ctrl-C is pressed when `bitcoin-node` is started, it is
handled by both `bitcoin-node` and `bitcoin-wallet` processes, causing the
wallet to shutdown abruptly instead of waiting for the node and shutting down
cleanly.

This change fixes the problem by having the wallet process print to stdout when
it receives a Ctrl-C signal but not otherwise react, letting the node shut
everything down cleanly.
2025-04-24 15:15:08 -04:00
Ryan Ofsky
6427d6f175 doc: Improve IPC interface comments
Fix some comments that were referring to previous versions of these methods and
did not make sense.
2025-04-24 15:13:05 -04:00
Ryan Ofsky
8ca7049cea ipc: Avoid waiting for clients to disconnect when shutting down
This fixes behavior reported by Antoine Poinsot <darosior@protonmail.com>
https://github.com/bitcoin/bitcoin/pull/29409#issuecomment-2546088852 where if
an IPC client is connected, the node will wait forever for it to disconnect
before exiting.
2025-04-24 15:02:19 -04:00
Ryan Ofsky
cf1c26a3a2 test: Add unit test coverage for Init and Shutdown code
Currently this code is not called in unit tests. Calling should make it
possible to write tests for things like IPC exceptions being thrown during
shutdown.
2025-04-24 05:53:03 -04:00

View file

@ -214,7 +214,10 @@ BasicTestingSetup::~BasicTestingSetup()
} else {
fs::remove_all(m_path_root);
}
// Clear all arguments except for -datadir, which GUI tests currently rely
// on to be set even after the testing setup is destroyed.
gArgs.ClearArgs();
gArgs.ForceSetArg("-datadir", fs::PathToString(m_path_root));
}
ChainTestingSetup::ChainTestingSetup(const ChainType chainType, TestOpts opts)