merge-script
f58de8749e
Merge bitcoin/bitcoin#32345 : ipc: Handle unclean shutdowns better
...
2581258ec2 ipc: Handle bitcoin-wallet disconnections (Ryan Ofsky)
2160995916 ipc: Add Ctrl-C handler for spawned subprocesses (Ryan Ofsky)
0c28068ceb doc: Improve IPC interface comments (Ryan Ofsky)
7f65aac78b ipc: Avoid waiting for clients to disconnect when shutting down (Ryan Ofsky)
6eb09fd614 test: Add unit test coverage for Init and Shutdown code (Ryan Ofsky)
9a9fb19536 ipc: Use EventLoopRef instead of addClient/removeClient (Ryan Ofsky)
e886c65b6b Squashed 'src/ipc/libmultiprocess/' changes from 27c7e8e5a581..b4120d34bad2 (Ryan Ofsky)
Pull request description:
This PR fixes various problems when IPC connections are broken or hang which were reported in https://github.com/bitcoin-core/libmultiprocess/issues/123 , https://github.com/bitcoin-core/libmultiprocess/issues/176 , and https://github.com/bitcoin-core/libmultiprocess/pull/182 . The different fixes are described in commit messages.
---
The first two commits of this PR update the libmultiprocess subtree including the following PRs:
- https://github.com/bitcoin-core/libmultiprocess/pull/181
- https://github.com/bitcoin-core/libmultiprocess/pull/179
- https://github.com/bitcoin-core/libmultiprocess/pull/160
- https://github.com/bitcoin-core/libmultiprocess/pull/184
- https://github.com/bitcoin-core/libmultiprocess/pull/187
- https://github.com/bitcoin-core/libmultiprocess/pull/186
- https://github.com/bitcoin-core/libmultiprocess/pull/192
The subtree changes can be verified by running `test/lint/git-subtree-check.sh src/ipc/libmultiprocess` as described in [developer notes](https://github.com/bitcoin/bitcoin/blob/master/doc/developer-notes.md#subtrees ) and [lint instructions](https://github.com/bitcoin/bitcoin/tree/master/test/lint#git-subtree-checksh ).
The remaining commits are:
- [`9a9fb19536fa` ipc: Use EventLoopRef instead of addClient/removeClient](9a9fb19536 )
- [`6eb09fd6141f` test: Add unit test coverage for Init and Shutdown code](6eb09fd614 )
- [`7f65aac78b95` ipc: Avoid waiting for clients to disconnect when shutting down](7f65aac78b )
- [`0c28068ceb7b` doc: Improve IPC interface comments](0c28068ceb )
- [`216099591632` ipc: Add Ctrl-C handler for spawned subprocesses](2160995916 )
- [`2581258ec200` ipc: Handle bitcoin-wallet disconnections](2581258ec2 )
The new commits depend on the subtree update, and because the subtree update includes an incompatible API change, the "Use EventLoopRef" commit needs to be part of the same PR to avoid breaking the build. The other commits also make sense to merge at the same time because the bitcoin & libmultiprocess changes were written and tested together.
---
This PR is part of the [process separation project](https://github.com/bitcoin/bitcoin/issues/28722 ).
ACKs for top commit:
Sjors:
re-utACK 2581258ec2
josibake:
code review ACK 2581258ec2
pinheadmz:
re-ACK 2581258ec2
Tree-SHA512: 0095aa22d507803e2a2d46eff51fb6caf965cc0c97ccfa615bd97805d5d51e66a5b4b040640deb92896438b1fb9f6879847124c9d0e120283287bfce37b8d748
2025-08-18 20:19:19 +01:00
Ryan Ofsky
9a9fb19536
ipc: Use EventLoopRef instead of addClient/removeClient
...
Use EventLoopRef to avoid reference counting bugs and be more exception safe
and deal with removal of addClient/removeClient methods in
https://github.com/bitcoin-core/libmultiprocess/pull/160
A test update is also required due to
https://github.com/bitcoin-core/libmultiprocess/pull/160 to deal with changed
reference count semantics. In IpcPipeTest(), it is now necessary to destroy
the client Proxy object instead of just the client Connection object to
decrease the event loop reference count and allow the loop to exit so the test
does not hang on shutdown.
2025-08-04 12:38:26 -05:00
MarcoFalke
face8123fd
log: [refactor] Use info level for init logs
...
This refactor does not change behavior.
2025-07-25 09:50:50 +02:00
Sjors Provoost
6077157531
ipc: drop BlockValidationState special handling
...
The Mining interface avoids using BlockValidationState.
2025-06-14 14:32:45 +02:00
fanquake
e50312eab0
doc: fix typos
...
Co-authored-by: Ragnar <rodiondenmark@gmail.com >
Co-authored-by: VolodymyrBg <aqdrgg19@gmail.com >
2025-06-03 08:09:28 +01:00
marcofleon
3c5d1a4681
Remove checkpoints
...
The headers presync logic should be enough to prevent memory DoS using
low-work headers. Therefore, we no longer have any use for checkpoints.
2025-03-13 11:13:13 +00:00
Ryan Ofsky
4e0aa1835b
test: Add test for IPC serialization bug
...
Add regression test for serialization bug in IPC mining code that is not
currently being called anywhere reported:
https://github.com/Sjors/bitcoin/issues/71
https://github.com/chaincodelabs/libmultiprocess/issues/122
2025-01-26 14:13:47 -05:00
Ryan Ofsky
90b405516f
Update libmultiprocess library
...
Add recent changes and fixes for shutdown bugs.
https://github.com/chaincodelabs/libmultiprocess/pull/111 : doc: Add internal design section
https://github.com/chaincodelabs/libmultiprocess/pull/113 : Add missing include to util.h
https://github.com/chaincodelabs/libmultiprocess/pull/116 : shutdown bugfix: destroy RPC system before running cleanup callbacks
https://github.com/chaincodelabs/libmultiprocess/pull/118 : shutdown bugfix: Prevent segfault in server if connection is broken during long function call
https://github.com/chaincodelabs/libmultiprocess/pull/119 : cmake: avoid libatomic not found error on debian
2024-10-16 12:13:27 -04:00
Ryan Ofsky
d043950ba2
multiprocess: Add serialization code for BlockValidationState
...
Co-authored-by: TheCharlatan <seb.kung@gmail.com >
2024-09-23 16:03:04 -04:00
Russell Yanofsky
06882f8401
multiprocess: Add serialization code for vector<char>
2024-09-23 15:03:04 -05:00
Russell Yanofsky
095286f790
multiprocess: Add serialization code for CTransaction
...
Add support for passing CTransaction and CTransactionRef types to IPC
functions.
These types can't be passed currently because IPC serialization code currently
only supports deserializing types that have an Unserialize() method, which
CTransaction does not, because it is supposed to represent immutable
transactions. Work around this by adding a CustomReadField overload that will
call CTransaction's deserialize_type constructor.
These types also can't be passed currently because serializing transactions
requires TransactionSerParams to be set. Fix this by setting TX_WITH_WITNESS as
default serialization parameters for IPC code.
2024-09-23 15:03:04 -05:00
Ryan Ofsky
73fe7d7230
multiprocess: Add unit tests for connect, serve, and listen functions
2024-09-06 09:08:10 -04:00
Ryan Ofsky
6acec6b9ff
multiprocess: Add type conversion code for UniValue types
...
Extend IPC unit test to cover this and verify the serialization happens
correctly.
2023-11-28 12:35:50 -05:00
Ryan Ofsky
0cc74fce72
multiprocess: Add type conversion code for serializable types
...
Allow any C++ object that has Serialize and Unserialize methods and can be
serialized to a bitcoin CDataStream to be converted to a capnproto Data field
and passed as arguments or return values to capnproto methods using the Data
type.
Extend IPC unit test to cover this and verify the serialization happens
correctly.
2023-11-28 12:35:50 -05:00
Ryan Ofsky
4aaee23921
test: add ipc test to test multiprocess type conversion code
...
Add unit test to test IPC method calls and type conversion between bitcoin c++
types and capnproto messages.
Right now there are custom type hooks in bitcoin IPC code, so the test is
simple, but in upcoming commits, code will be added to convert bitcoin types to
capnproto messages, and the test will be expanded.
2023-11-28 12:35:50 -05:00