On unix systems, the --enable-multiprocess build option can be passed to ./configure to build new CleanCoin-node, CleanCoin-wallet, and CleanCoin-gui executables alongside existing CleanCoind and CleanCoin-qt executables.
CleanCoin-node is a drop-in replacement for CleanCoind, and CleanCoin-gui is a drop-in replacement for CleanCoin-qt, and there are no differences in use or external behavior between the new and old executables. But internally (after #10102), CleanCoin-gui will spawn a CleanCoin-node process to run P2P and RPC code, communicating with it across a socket pair, and CleanCoin-node will spawn CleanCoin-wallet to run wallet code, also communicating over a socket pair. This will let node, wallet, and GUI code run in separate address spaces for better isolation, and allow future improvements like being able to start and stop components independently on different machines and environments.
Specific next steps after #10102 will be:
- Adding
-ipcbindand-ipcconnectoptions toCleanCoin-node,CleanCoin-wallet, andCleanCoin-guiexecutables so they can listen and connect to TCP ports and unix socket paths. This will allow separate processes to be started and stopped any time and connect to each other. - Adding
-serverand-rpcbindoptions to theCleanCoin-walletexecutable so wallet processes can handle RPC requests directly without going through the node. - Supporting windows, not just unix systems. The existing socket code is already cross-platform, so the only windows-specific code that needs to be written is code spawning a process and passing a socket descriptor. This can be implemented with
CreateProcessandWSADuplicateSocket. Example: https://memset.wordpress.com/2010/10/13/win32-api-passing-socket-with-ipc-method/. - Adding sandbox features, restricting subprocess access to resources and data. See https://eklitzke.org/multiprocess-CleanCoin.
After #10102, the -debug=ipc command line option can be used to see requests and responses between processes.
The multiprocess feature requires Cap'n Proto and libmultiprocess as dependencies. A simple way to get starting using it without installing these dependencies manually is to use the depends system with the MULTIPROCESS=1 dependency option passed to make:
cd <CleanCoin_SOURCE_DIRECTORY>
make -C depends NO_QT=1 MULTIPROCESS=1
./configure --prefix=$PWD/depends/x86_64-pc-linux-gnu
make
src/CleanCoin-node -regtest -printtoconsole -debug=ipc
CleanCoinD=CleanCoin-node test/functional/test_runner.py
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).
Alternately, you can install Cap'n Proto and 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. See Installation section of the libmultiprocess readme for install steps. See build-unix.md and build-osx.md for information about installing dependencies in general.