You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Merge bitcoin#19160: multiprocess: Add basic spawn and IPC support
84934bf multiprocess: Add echoipc RPC method and test (Russell Yanofsky)
7d76cf6 multiprocess: Add comments and documentation (Russell Yanofsky)
ddf7ecc multiprocess: Add bitcoin-node process spawning support (Russell Yanofsky)
10afdf0 multiprocess: Add Ipc interface implementation (Russell Yanofsky)
745c9ce multiprocess: Add Ipc and Init interface definitions (Russell Yanofsky)
5d62d7f Update libmultiprocess library (Russell Yanofsky)
Pull request description:
This PR is part of the [process separation project](https://github.com/bitcoin/bitcoin/projects/10).
---
This PR adds basic process spawning and IPC method call support to `bitcoin-node` executables built with `--enable-multiprocess`[*].
These changes are used in bitcoin#10102 to let node, gui, and wallet functionality run in different processes, and extended in bitcoin#19460 and bitcoin#19461 after that to allow gui and wallet processes to be started and stopped independently and connect to the node over a socket.
These changes can also be used to implement new functionality outside the `bitcoin-node` process like external indexes or pluggable transports (bitcoin#18988). The `Ipc::spawnProcess` and `Ipc::serveProcess` methods added here are entry points for spawning a child process and serving a parent process, and being able to make bidirectional, multithreaded method calls between the processes. A simple example of this is implemented in commit "Add echoipc RPC method and test."
Changes in this PR aside from the echo test were originally part of bitcoin#10102, but have been split and moved here for easier review, and so they can be used for other applications like external plugins.
Additional notes about this PR can be found at https://bitcoincore.reviews/19160
[*] Note: the `--enable-multiprocess` feature is still experimental, and not enabled by default, and not yet supported on windows. More information can be found in [doc/multiprocess.md](https://github.com/bitcoin/bitcoin/blob/master/doc/multiprocess.md)
ACKs for top commit:
fjahr:
re-ACK 84934bf
ariard:
ACK 84934bf. Changes since last ACK fixes the silent merge conflict about `EnsureAnyNodeContext()`. Rebuilt and checked again debug command `echoipc`.
Tree-SHA512: 52a948b5e18a26d7d7a09b83003eaae9b1ed2981978c36c959fe9a55abf70ae6a627c4ff913a3428be17400a3dace30c58b5057fa75c319662c3be98f19810c6
Copy file name to clipboardexpand all lines: doc/multiprocess.md
+38-1
Original file line number
Diff line number
Diff line change
@@ -15,7 +15,7 @@ Specific next steps after backporting [bitcoin#10102](https://github.com/bitcoin
15
15
16
16
## Debugging
17
17
18
-
After backporting [bitcoin#10102](https://github.com/bitcoin/bitcoin/pull/10102), the`-debug=ipc` command line option can be used to see requests and responses between processes.
18
+
The`-debug=ipc` command line option can be used to see requests and responses between processes.
The configure script will pick up settings and library locations from the depends directory, so there is no need to pass `--enable-multiprocess` as a separate flag when using the depends system (it's controlled by the `MULTIPROCESS=1` option).
34
34
35
35
Alternately, you can install [Cap'n Proto](https://capnproto.org/) and [libmultiprocess](https://github.com/chaincodelabs/libmultiprocess) packages on your system, and just run `./configure --enable-multiprocess` without using the depends system. The configure script will be able to locate the installed packages via [pkg-config](https://www.freedesktop.org/wiki/Software/pkg-config/). See [Installation](https://github.com/chaincodelabs/libmultiprocess#installation) section of the libmultiprocess readme for install steps. See [build-unix.md](build-unix.md) and [build-osx.md](build-osx.md) for information about installing dependencies in general.
36
+
37
+
## IPC implementation details
38
+
39
+
Cross process Node, Wallet, and Chain interfaces are defined in
40
+
[`src/interfaces/`](../src/interfaces/). These are C++ classes which follow
41
+
[conventions](developer-notes.md#internal-interface-guidelines), like passing
42
+
serializable arguments so they can be called from different processes, and
43
+
making methods pure virtual so they can have proxy implementations that forward
44
+
calls between processes.
45
+
46
+
When Wallet, Node, and Chain code is running in the same process, calling any
47
+
interface method invokes the implementation directly. When code is running in
48
+
different processes, calling an interface method invokes a proxy interface
49
+
implementation that communicates with a remote process and invokes the real
Copy file name to clipboardexpand all lines: src/interfaces/README.md
+4-2
Original file line number
Diff line number
Diff line change
@@ -12,6 +12,8 @@ The following interfaces are defined here:
12
12
13
13
*[`Handler`](handler.h) — returned by `handleEvent` methods on interfaces above and used to manage lifetimes of event handlers.
14
14
15
-
*[`Init`](init.h) — used by multiprocess code to access interfaces above on startup. Added in [#10102](https://github.com/bitcoin/bitcoin/pull/10102).
15
+
*[`Init`](init.h) — used by multiprocess code to access interfaces above on startup. Added in [#6143](https://github.com/dashpay/dash/pull/6143).
16
16
17
-
The interfaces above define boundaries between major components of bitcoin code (node, wallet, and gui), making it possible for them to run in different processes, and be tested, developed, and understood independently. These interfaces are not currently designed to be stable or to be used externally.
17
+
*[`Ipc`](ipc.h) — used by multiprocess code to access `Init` interface across processes. Added in [#6143](https://github.com/dashpay/dash/pull/6143).
18
+
19
+
The interfaces above define boundaries between major components of bitcoin code (node, wallet, and gui), making it possible for them to run in [different processes](../../doc/multiprocess.md), and be tested, developed, and understood independently. These interfaces are not currently designed to be stable or to be used externally.
0 commit comments