RFC: Multiprocess binaries and packaging options #30983

issue ryanofsky openend this issue on September 26, 2024
  1. ryanofsky commented at 7:06 pm on September 26, 2024: contributor

    Issue for discussion about ways multiprocess functionality could be packaged and released. Trying to figure out which of the 3 release options described below makes the most sense.

    Binaries

    One goal of the multiprocess project has been to provide minimal binaries that only include node, wallet, or gui code, which spawn or connect to other processes as needed to provide other functionality.

    The idea implemented in #10102 is to have 3 binaries:

    • bitcoin-node - contains node code and libraries (leveldb), and no wallet or gui code
    • bitcoin-wallet - contains wallet code and libraries (sqlite), and no node or gui code
    • bitcoin-gui - contains gui code and libraries (qt), and no node or wallet code

    Which are built differently than current binaries:

    • bitcoind - contains node code+libraries (leveldb) and wallet code+libraries (sqlite)
    • bitcoin-qt - contains node code+libraries (leveldb), wallet code+libraries (sqlite), and gui code+libraries (qt)

    Original release plan

    My original idea implementing this was for there to be a separate multiprocess bitcoin release with the multiprocess binaries.

    The main release would be unchanged, including existing bitcoind and bitcoin-qt binaries, but there would be a separate release containing bitcoin-node, bitcoin-wallet and bitcoin-gui binaries. The main release would be available in the normal place like bitcoincore.org/bin/bitcoin-core-27.1/, and the multiprocess release would be available alongside, at bitcoincore.org/bin/bitcoin-core-multiprocess-27.1/ or someplace similar. Then, after a release cycle or two, the multiprocess release could replace the main release if it was working well.

    But this approach has some drawbacks, namely that it would be a burden for maintainers to create separate releases and make them accessible, and that it could be confusing for users to encounter two releases with different binaries. So it doesn’t seem like this approach is optimal (at least not for general users, maybe it would be ok for miners using the IPC mining interface).

    Release options overview

    Taking a step back, it seems like there are 3 possible options for releasing multiprocess functionality:

    1. Side-release: create a separate multiprocess release for multiprocess binaries, as described above.
    2. Side-binaries: add multiprocess binaries (bitcoin-node, bitcoin-wallet, bitcoin-gui) to existing releases alongside existing binaries (bitcoind and bitcoin-qt).
    3. Combined binaries: add multiprocess functionality to existing bitcoind and bitcoin-qt binaries that can be enabled/disabled with runtime arguments.

    Release options comparison

    From discussion in recent PR’s and offline, it seems like approach (3) might be favored, but it is worth considering pros and cons of the three approaches.

    1. Side-release

      • Pros:
        • Opt-in: Keeps original binaries unchanged for users who don’t want multiprocess functionality.
        • Minimal binaries: Node binary contains only node code not wallet code, gui binary contains no node or wallet code.
      • Cons:
        • Extra work: It’s more work for maintainers and signers to create an extra set of packages and make them accessible.
        • Complexity: Posting a separate release could be confusing for users.
    2. Side-binaries:

      • Pros:
        • Opt-in and Minimal binaries: same as previous
        • Easy to implement: Implemented in #30975 and basically requires no changes other than flipping cmake options.
      • Cons:
        • Confusing: This would probably be the most confusing approach for users. They would see one release with bitcoind, bitcoin-qt, bitcoin-node, bitcoin-wallet, bitcoin-gui binaries and not be able to easily understand how they are intended to be used.
      • Potential mitigations:
        • We would probably put multiprocess binaries in another folder (like multiprocess/bin/ instead of bin/) so they are clearly labeled and aren’t confused with the default binaries.

        • We might want to rethink our approach to packaging binaries to begin with. We are already shipping a substantial collection of binaries: bitcoin-cli, bitcoind, bitcoin-qt, bitcoin-tx, bitcoin-util, bitcoin-wallet, and test_bitcoin which users are expected to call individually, and are probably already somewhat confusing. By contrast, git ships dozens of binaries and nobody is confused by them because they live in a libexec directory and are wrapped with single git command that finds and executes the right ones. Maybe taking git as inspiration we could have add a unified bitcoin command that looks like:

          0bitcoin gui [OPTIONS]             # Start a gui
          1bitcoin daemon [OPTIONS]          # Start a daemon
          2bitcoin rpc [OPTIONS] COMMAND     # Call an rpc
          3bitcoin wallet [OPTIONS] COMMAND  # Access a wallet
          4bitcoin test [OPTIONS]            # Run tests
          5bitcoin help
          6# ... and more for bitcoin-util, bitcoin-tx ...
          
    3. Combined binaries:

      • Pros:
        • Compatibility: Users could download and invoke bitcoind and bitcoin-qt binaries as before, not know they support IPC, not use IPC unless it’s switched on by default, and there would be runtime options to turn it on or off.
      • Cons:
        • Bigger binaries and more dependencies: Binaries will both contain node, wallet, and IPC code. There will be no non-IPC binaries users can deploy and run separately if they don’t use IPC, and no node binary users can deploy and run separately if they don’t use the wallet, or want to run the wallet and node on different hosts.
        • Requires code changes: Will require some thinking about how to add runtime options to #10102 to control whether bitcoind should spawn separate wallet process or run wallet code internally, and similarly whether bitcoin-gui should use a separate node process or run node code in the same process. Will also require updating the build system.

    As mentioned, approach (3) seems favored so far, though personally I like approach (2), especially if we could have a unified bitcoin command.

    Creating this issue to get feedback and document any decisions we make.

  2. Sjors commented at 9:15 am on September 27, 2024: member

    I like the idea of a unified bitcoin command.

    We could start with seperate binaries for multiprocess, e.g.:

    • bitcoin daemon (for bitcoind)
    • bitcoin daemon multiprocess for bitcoin-node
    • bitcoin gui (for bitcoin-qt)
    • bitcoin gui multiprocess (for bitcoin-gui)

    And perhaps not worry about just including multiprocess in the utilities:

    • bitcoin wallet (for bitcoin-wallet)

    Then later on the multiprocess option could be made default and we drop the non-multiprocess binary.

    The existing bitcoind, bitcoin-qt and bitcoin-cli and binaries should probably stay where they are. Later on they can be changed to emit a deprecation warning “use bitcoin daemon instead”, and then eventually deleted.

  3. hebasto commented at 11:37 am on September 27, 2024: member

    I like the idea of a unified bitcoin command.

    So do I.

    Would it be beneficial for users if we started shipping DEB and RPM packages? The package manager would handle the proper installation of multiple executables.

  4. maflcko commented at 11:55 am on September 27, 2024: member

    Would it be beneficial for users if we started shipping DEB and RPM packages? The package manager would handle the proper installation of multiple executables.

    IIRC there were some in the packagin repo, but they were both removed due to being unmaintained, see https://github.com/bitcoin-core/packaging?tab=readme-ov-file#bitcoin-core-packaging

  5. ryanofsky commented at 12:48 pm on September 27, 2024: contributor

    re: #30983 (comment)

    We could start with seperate binaries for multiprocess, e.g.:

    This makes sense. Initially I was thinking all the binaries had to live in the same place, but this is not true. We could leave all existing binaries where they are in bin/ and just add 3 new files to releases when multiprocess option is turned on:

    • bin/bitcoin
    • libexec/bitcoin-node
    • libexec/bitcoin-gui

    Implementing this might be as simple as changing installation path for bitcoin-node and bitcoin-gui from BINDIR to LIBEXECDIR in cmake, and then writing the bitcoin wrapper as described above. The wrapper could just look for whatever binary it was trying to start in the libexec/ directory first and bin/ directory second.

    On command lines you suggested, I think they make sense but might suggest:

    • bitcoin daemon as synonym for bitcoind
    • bitcoin gui as synonym for bitcoin-qt
    • bitcoin rpc as synonym for bitcoin-cli
    • bitcoin -m daemon as synonym for bitcoin-node
    • bitcoin -m gui as synonym for bitcoin-gui

    etc

    re: #30983 (comment)

    On DEB and RPM packages, I’m sure they could be useful for their own reasons, but I don’t know if they offer things that would specifically help with this issue, and I think a bitcoin wrapper should be able to work well regardless of the release format.

  6. Sjors commented at 12:56 pm on September 27, 2024: member

    bitcoin -m daemon -debug=net as a format indeed makes sense. It makes it more clear which arguments are passed into bitcoin-node.

    While you’re add it, -v could switch versions if we use libexec/version/ as the directory. Though outside the functional tests there’s probably no use for that, and it’s potentially dangerous to switch between versions.

  7. MrSuddenJoy commented at 1:29 pm on September 27, 2024: none

    @ryanofsky bin/bitcoin should (or could) be meta-process of all others that you mentioned. Just symlink maybe?

    Or just use dickary dependencies.

  8. ryanofsky commented at 3:44 pm on September 30, 2024: contributor

    @ryanofsky bin/bitcoin should (or could) be meta-process of all others that you mentioned. Just symlink maybe?

    It could be a symlink to existing executable, which could interpret its arguments as needed based on argv[0], instead of being a new executable. But I think having a new executable that calls exec https://man7.org/linux/man-pages/man3/exec.3.html would be more straightforward

  9. willcl-ark commented at 9:03 am on October 1, 2024: member

    I very much like the idea of the wrapper approach described in #30983 (comment), it feels to me like the correct way to structure and package an application consisting of multiple binaries rather than overloading existing binaries with even more options.

    My only reservation with the approach is the potential magnitude of the effects downstream. If executed poorly this could break many scripts, programs and general infra. However, so long as we maintain the current binary names in the current directory, as currently proposed, and only introduce a new wrapper around them, then it seems like it should mitigate any downstream impact (completely).

  10. ryanofsky referenced this in commit 65e49f4579 on Oct 1, 2024
  11. ryanofsky commented at 8:29 pm on October 1, 2024: contributor

    Here’s an initial implementation of a bitcoin wrapper executable: commit 65e49f4579ee823284bf04f1295b59116acc727b (branch)

    This should be purely additive, and to willcl-ark’s point, not break backwards compatibility. It just lets us add new binaries to a libexec/ directory instead of bin/.

  12. MrSuddenJoy commented at 10:49 am on October 2, 2024: none

    @ryanofsky Not entirely sure this is way to go imho.

    As long as everything works well ( = as expected ) its all ok, but as soon as things go south, problems (especially ones that are hard to solve/complex) start to accumulate/pile up. And thats exactly whats root cause of many bad things, namely frustration, burn-out and things like this.

    Having meta-package has proven (to me) to be perfect cure for problems described above. If something breaks, its dead simple to: localise where (in code) fault is, fix it, and prevent it from happening again.

  13. josibake commented at 1:15 pm on October 2, 2024: member

    Echoing others, I like option 2 (side-binaries). A bitcoin <cmd> wrapper on top of multiple binaries also seems quite nice. While this might cause some confusion for end users, I think this will be far less confusing than having a side release (and much less work for maintainers and guix builders).

    Regarding option 3, one of the value propositions of multiprocess in my mind is being able to run a binary for a specific purpose, with only the code needed for that purpose in the binary, e.g., running bitcoin-node on a server without wanting/needing a wallet or gui. Option 3 seems to undermine that, while also introducing complexity (as mentioned in the cons).


github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2024-11-21 12:12 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me