-
Notifications
You must be signed in to change notification settings - Fork 37.7k
multiprocess: Add bitcoin-gui -ipcconnect option #19461
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. Code Coverage & BenchmarksFor details see: https://corecheck.dev/bitcoin/bitcoin/pulls/19461. ReviewsSee the guideline for information on the review process.
If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update. ConflictsReviewers, this pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first. |
Needed because BlockConnected notifications are a lot slower with the wallet running in separate process.
Make default constructor more generic so it doesn't only work with void types.
Spawn node subprocess instead of running node code internally
Spawn wallet subprocess instead of running wallet code internally
Add .wallet/.gui suffixes to log files created by bitcoin-gui and bitcoin-wallet processes so they don't clash with bitcoin-node log file.
Add `-ipcconnect` option to `bitcoin-wallet` to allow connecting to a bitcoin node process over IPC. The `bitcoin-wallet` tool doesn't really do anything with its connection to the node yet, but it could potentially run or serve RPCs that require being online. Example usage: src/bitcoin-node -regtest -debug -ipcbind=unix src/bitcoin-wallet -regtest -ipcconnect=unix info
Add `-ipcconnect` option to `bitcoin-gui` to allow connecting gui to an existing node instead of starting a new node process, so it is possible to start and stop the gui independently of the node. This change doesn't add an -ipcbind option to the bitcoin-wallet (which would allow the gui to control wallet processes without going through the node), but this would be a logical extension to add in the future.
As promised in #10102 comments, I tried out
Note: Please reference Interestingly, a prior revision to docs/developer-notes.md#wallet expands on this and references an obsolete/superceded test:
I did not yet try and debug the crash as I'm not totally sure I built from the correct integration branch for this? |
🐙 This pull request conflicts with the target branch and needs rebase. |
Thanks for the report. I created bitcoin-core/libmultiprocess#169 to track it. It sounds like you are using the correct branch, and as long as you are using any branch containing the changes in this PR, following those steps should not crash and the fact that they do is a bug. I'm trying to reproduce the crash now and will add a stack trace to bitcoin-core/libmultiprocess#169 if I can. I'd expect fixing this to be pretty simple after that. |
Thank you; glad to hear you were able to easily reproduce. I did not report an issue myself only because:
Saw one other statement to this effect, but can't place it RN, will reference here if I can. I also would also be interested in seeing multiprocess achieve the goal of not having the node act as a go-between for wallet RPCs, and might be personally interested on working on any formal software "interface rationalization" spec to that end, if one doesn't exist already. |
⌛ There hasn't been much activity lately and the patch still needs rebase. What is the status here?
|
This is a draft PR because it is based on #29409 + #10102 + #19460. The non-base commits are:
dbced82bbafd
multiprocess: Add bitcoin-gui -ipcconnect optionBuilding on #10102, this adds an
-ipcconnect
option tobitcoin-gui
that connects the GUI to an existingbitcoin-node
process already running in the background instead of spawning a newbitcoin-node
process. This allows the GUI to be started and stopped independently of the node. By default with this change,bitcoin-gui
will check if a<datadir>/sockets/node.sock
socket exists and try to connect to that. If that doesn't work, it will spawn a new node process and start up the same way it did before this PR.The default
bitcoin-gui
connect option is-ipcconnect=auto
, which tries to connect if possible as described above, and spawns a newbitcoin-node
process if not possible. Other supported options are-noipcconnect
to never connect to an existing node and always spawn a new one,-ipcconnect
to require a connection and fail if it can't be established, and-ipcconnect=unix:<socket>
to require a connection and use a custom socket path.With this PR, basic functionality works and gui instances can connect and disconnect from a running node. But there are rough edges: If a gui process doesn't shut down cleanly, the node can see unhandled IpcExceptions, and if node command line options are passed to
bitcoin-gui
andbitcoin-gui
connects to an exiting bitcoin-node process instead of spawning a new one, the node options will be silently ignored.These changes require multiprocess support and this PR has no effect unless bitcoin is configured with
--enable-multiprocess
as described in doc/multiprocess.mdThis PR is part of the process separation project.