ipc: add windows support #32387

pull ryanofsky wants to merge 37 commits into bitcoin:master from ryanofsky:pr/ipc-win changing 52 files +853 −685
  1. ryanofsky commented at 12:43 PM on April 30, 2025: contributor

    These changes make IPC features work on windows, resolving https://github.com/bitcoin-core/libmultiprocess/issues/53 and https://github.com/bitcoin-core/libmultiprocess/issues/114

    This is a draft because it is based on https://github.com/bitcoin-core/libmultiprocess/pull/231 and #35084.


    This PR is part of the process separation project.

  2. DrahtBot commented at 12:43 PM on April 30, 2025: contributor

    <!--e57a25ab6845829454e8d69fc972939a-->

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    <!--006a51241073e994b41acfe9ec718e94-->

    Code Coverage & Benchmarks

    For details see: https://corecheck.dev/bitcoin/bitcoin/pulls/32387.

    <!--021abf342d371248e50ceaed478a90ca-->

    Reviews

    See the guideline for information on the review process.

    Type Reviewers
    Concept ACK hebasto

    If your review is incorrectly listed, please copy-paste <code>&lt;!--meta-tag:bot-skip--&gt;</code> into the comment that the bot should ignore.

    <!--174a7506f384e20aa4161008e828411d-->

    Conflicts

    Reviewers, this pull request conflicts with the following ones:

    • #35037 (ipc: support per-address max-connections options on -ipcbind by enirox001)
    • #34806 (refactor: logging: Various API improvements by ajtowns)
    • #34020 (mining: add getTransactions(ByWitnessID) IPC methods by Sjors)
    • #33974 (cmake: Check dependencies after build option interaction by hebasto)
    • #33593 (guix: Use UCRT runtime for Windows release binaries by hebasto)
    • #31974 (Drop testnet3 by Sjors)
    • #19461 (multiprocess: Add bitcoin-gui -ipcconnect option by ryanofsky)
    • #19460 (multiprocess: Add bitcoin-wallet -ipcconnect option by ryanofsky)
    • #10102 (Multiprocess bitcoin by ryanofsky)

    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.

    <!--5faf32d7da4f0f540f40219e4f7537a3-->

    LLM Linter (✨ experimental)

    Possible places where comparison-specific test macros should replace generic comparisons:

    • [src/ipc/test/ipc_tests.cpp] BOOST_CHECK_THROW(process->bind(datadir, "test_bitcoin", invalid_bind), std::invalid_argument); -> Consider BOOST_CHECK_EXCEPTION with a matcher that verifies the exception message, instead of checking only the exception type.
    • [src/ipc/test/ipc_tests.cpp] BOOST_CHECK_THROW(process->connect(datadir, "test_bitcoin", invalid_bind), std::invalid_argument); -> Consider BOOST_CHECK_EXCEPTION with a matcher that verifies the exception message, instead of checking only the exception type.

    <sup>2026-04-21 20:54:45</sup>

  3. ryanofsky force-pushed on Apr 30, 2025
  4. ryanofsky commented at 12:47 PM on April 30, 2025: contributor

    Updated 9df5a838aa9c020adf8d024393749d75bd932ec2 -> 87432b6a4325e09a13c912d77b386daa3832b34d (pr/ipc-win.1 -> pr/ipc-win.2, compare) fixing accidentally disabled tests

  5. hebasto commented at 1:47 PM on April 30, 2025: member

    Concept ACK.

  6. DrahtBot added the label CI failed on Apr 30, 2025
  7. DrahtBot commented at 3:00 PM on April 30, 2025: contributor

    <!--85328a0da195eb286784d51f73fa0af9-->

    🚧 At least one of the CI tasks failed. <sub>Task multiprocess, i686, DEBUG: https://github.com/bitcoin/bitcoin/runs/41420704031</sub> <sub>LLM reason (✨ experimental): The CI failure is caused by an assertion failure in the IPC test suite due to a nullptr dereference.</sub>

    <details><summary>Hints</summary>

    Try to run the tests locally, according to the documentation. However, a CI failure may still happen due to a number of reasons, for example:

    • Possibly due to a silent merge conflict (the changes in this pull request being incompatible with the current code in the target branch). If so, make sure to rebase on the latest commit of the target branch.

    • A sanitizer issue, which can only be found by compiling with the sanitizer and running the affected test.

    • An intermittent issue.

    Leave a comment here, if you need help tracking down a confusing failure.

    </details>

  8. Sjors commented at 7:12 PM on April 30, 2025: member

    I guess the easiest way to test this would be to combine it with:

    1. #31756 so I can bake a Widnows guix build instead of learning to compile on Windows; and
    2. #30437 to have something to test against
  9. ryanofsky force-pushed on Apr 30, 2025
  10. ryanofsky commented at 9:24 PM on April 30, 2025: contributor

    Updated 87432b6a4325e09a13c912d77b386daa3832b34d -> 0a35e21103b7fed6e46c809e9029446277b6f6ee (pr/ipc-win.2 -> pr/ipc-win.3, compare) to fix test CI failure https://cirrus-ci.com/task/5583224107171840 due to bad std::optional access Updated 0a35e21103b7fed6e46c809e9029446277b6f6ee -> 27328195136754babe8d8f5d99f4f0b6a5ab2e55 (pr/ipc-win.3 -> pr/ipc-win.4, compare) to fix CI test failure https://cirrus-ci.com/task/5668412652781568 in rpc_misc.py echoipc call due to CLOEXEC flag


    re: #32387 (comment)

    Agree changes in #31756 should make this easier to test (though I might be able to make a minimal change here to turn on multiprocess windows build).

    Having #30437 or #32297 merged first would also make test coverage more meaningful because they both add functional tests for -ipcbind and -ipcconect options.

    In general there is more work to do here and I hope other PRs can be merged before this one.

  11. ryanofsky force-pushed on May 1, 2025
  12. DrahtBot removed the label CI failed on May 1, 2025
  13. ryanofsky force-pushed on May 2, 2025
  14. ryanofsky commented at 9:12 PM on May 2, 2025: contributor

    Updated 27328195136754babe8d8f5d99f4f0b6a5ab2e55 -> f215e742045401ab386f0cd67d06b358558ecf89 (pr/ipc-win.4 -> pr/ipc-win.5, compare) fixing many windows bugs.

    With this update, IPC code is mostly working on windows: mpexample and mptest programs work, test_bitcoin IPC calls over socketpairs work, bitcoin-node echoipc command is able to create a subprocess and successfully make calls to it, and bitcoin-node -ipcbind option creates a unix socket file. Some problems remain:

    • This is a hang on shutdown that prevents child processes from exiting. You can kill them manually and everything works fine, but this problem needs to be debugged.
    • bitcoin-mine -ipcconnect seems unable to find the unix socket, failing with "Error: The system cannot find the file specified" even though the socket exists. Two test_bitcoin unix socket tests also give similar errors.
    • The test_bitcoin parse address tests fails because some checks are looking for / not \ separators.
  15. ryanofsky force-pushed on May 6, 2025
  16. ryanofsky commented at 3:09 PM on May 6, 2025: contributor

    Updated f215e742045401ab386f0cd67d06b358558ecf89 -> 5f272b7cc3b72fe4a59f590825b68dc2c342baca (pr/ipc-win.5 -> pr/ipc-win.6, compare) with more fixes.

    <!-- begin push-7 -->

    Updated 5f272b7cc3b72fe4a59f590825b68dc2c342baca -> 13aef5ad7669e0302e27f96876615907dc98c3c3 (pr/ipc-win.6 -> pr/ipc-win.7, compare)<!-- end --> improving comments.

    With the new fixes, IPC is fully working on windows: both creating child processes and communicating over socket pairs, and listening and making connections over unix sockets. (Latter currently requires adding a SetupNetworking call to bitcoin-mine in #30437). The code changes are also mostly straightforward and clean, although I want to split commits to make them easier to review.

    Will leave this PR in a draft state for now since other multiprocess PRs should have higher priority (see tracking issue #28722)

    --

    <!-- begin push-8 -->

    Rebased 13aef5ad7669e0302e27f96876615907dc98c3c3 -> cbd06846803e800f23f4498e27f930e09d260000 (pr/ipc-win.7 -> pr/ipc-win.8, compare)<!-- end --> due to conflicts with #32345

    <!-- begin push-9 -->

    Rebased cbd06846803e800f23f4498e27f930e09d260000 -> 3d0737720ae6bbd2c3eb4382e41fa49dd3d727d9 (pr/ipc-win.8 -> pr/ipc-win.9, compare)<!-- end --> due to conflicts with #33517

    <!-- begin push-10 -->

    Rebased 3d0737720ae6bbd2c3eb4382e41fa49dd3d727d9 -> 24f5e883f20d0c65bc163dba0e3d8c2f031c63c7 (pr/ipc-win.9 -> pr/ipc-win.10, compare)<!-- end --> due to conflict with #33960

    <!-- begin push-11 -->

    Rebased 24f5e883f20d0c65bc163dba0e3d8c2f031c63c7 -> ac0b14c567f40ed813f9bf2ebe316fcd8249ffbe (pr/ipc-win.10 -> pr/ipc-win.11, compare)<!-- end --> on top of https://github.com/bitcoin-core/libmultiprocess/pull/231 pr/win.3 and #35084 pr/ipc-wins.1

    <!-- begin push-12 -->

    Updated ac0b14c567f40ed813f9bf2ebe316fcd8249ffbe -> 533b3460457c0f26727646677cccb303a4036c7e (pr/ipc-win.11 -> pr/ipc-win.12, compare)<!-- end --> to fix ci errors https://github.com/bitcoin/bitcoin/actions/runs/24465570509 vcpkg capnproto dependency error, ipc_test cmake include directory errors, lint subtree error

    <!-- begin push-13 -->

    Updated 533b3460457c0f26727646677cccb303a4036c7e -> ec10ff7c9d9a82b5caee50e2d0d6b90a55fa8ea4 (pr/ipc-win.12 -> pr/ipc-win.13, compare)<!-- end --> to fix ci errors https://github.com/bitcoin/bitcoin/actions/runs/24539458137 in base prs: lint ipc_test.cpp boost test name error, and HasReason boost test include errors

    <!-- begin push-14 -->

    Updated ec10ff7c9d9a82b5caee50e2d0d6b90a55fa8ea4 -> 23b1d507334c6e429ca87ad6af2b401313a5623b (pr/ipc-win.13 -> pr/ipc-win.14, compare)<!-- end --> to fix bitcoin core macos exception type error https://github.com/bitcoin/bitcoin/actions/runs/24542080405/job/71749864777?pr=32387

    <!-- begin push-15 -->

    Updated 23b1d507334c6e429ca87ad6af2b401313a5623b -> 0211390861baa245ec77766f9a6f1d17ad441649 (pr/ipc-win.14 -> pr/ipc-win.15, compare)<!-- end --> to fix pthreads include error https://github.com/bitcoin/bitcoin/actions/runs/24543367909/job/71753783189?pr=32387 in native windows build and enable ipc in windows cross builds

    <!-- begin push-16 -->

    Updated 0211390861baa245ec77766f9a6f1d17ad441649 -> cac16bb4859b6b2ec96063ea52d71d997643c87c (pr/ipc-win.15 -> pr/ipc-win.16, compare)<!-- end --> to fix CI errors https://github.com/bitcoin/bitcoin/actions/runs/24545738655/job/71762261393?pr=32387 bitcoin-gui RC file error and commit message formatting lint error, also adding mp::MakeStream method to simplify changes

    <!-- begin push-17 -->

    Updated cac16bb4859b6b2ec96063ea52d71d997643c87c -> 6baabfe441da0a6430993d0e11d407a6416ece6f (pr/ipc-win.16 -> pr/ipc-win.17, compare)<!-- end --> to fix more RC file errors caused by build path problem in previous attempted fix https://github.com/bitcoin/bitcoin/actions/runs/24568789956/job/71836011315?pr=32387, which caused cross compiled windows builds to now fail as well as the native build. Also move previous fix for pthreads include error to a new commit also implementing a fix for a unistd include error in the msvc build. Also rearrange commits and add a whitespace fix to fix a lint error.

    <!-- begin push-18 -->

    Updated 6baabfe441da0a6430993d0e11d407a6416ece6f -> d53bc6c783e7e91bc06f23140f8415eb48c9ab0b (pr/ipc-win.17 -> pr/ipc-win.18, compare)<!-- end --> to fix another msvc (non-mingw) posix error with execvp, and a wsasocket error https://github.com/bitcoin/bitcoin/actions/runs/24575486745/job/71859566530?pr=32387, also more cross-compiled test manifest rc errors

    <!-- begin push-19 -->

    Updated d53bc6c783e7e91bc06f23140f8415eb48c9ab0b -> aa323482ccb40edf3b6bfed16d3e136257ca5d6e (pr/ipc-win.18 -> pr/ipc-win.19, compare)<!-- end --> to fix more ci errors https://github.com/bitcoin/bitcoin/actions/runs/24582112980/job/71882361998?pr=32387: MSVC errors dealing with std::variant (known compiler bug) and workaround for lack of fork in mpgen(). Also ipc_tests.cpp fix for incorrect closesocket call in test. Also added /k option to msvc build to try to get more complete lists of compiler errors

    <!-- begin push-20 -->

    Updated aa323482ccb40edf3b6bfed16d3e136257ca5d6e -> 68bc7eeff2ffd44d79e8669fc8dc8b335ae18e7d (pr/ipc-win.19 -> pr/ipc-win.20, compare)<!-- end --> to fix error from /k flag https://github.com/bitcoin/bitcoin/actions/runs/24587189710/job/71899642665?pr=32387, also cleaning up internal commits and replacing confusing SpawnProcess overload

    <!-- begin push-21 -->

    Updated 68bc7eeff2ffd44d79e8669fc8dc8b335ae18e7d -> 855cfb764d21e1b6f05c26d5cfadd0a2d165580d (pr/ipc-win.20 -> pr/ipc-win.21, compare)<!-- end --> reorganizing windows support comits and fixing ci errors: https://github.com/bitcoin/bitcoin/actions/runs/24589091659/job/71905779254?pr=32387 -Werror unused function warning in cross-compiled win32 job, and attempting to fix mpgen runtime error in visual studio ci job

    <!-- begin push-22 -->

    Updated 855cfb764d21e1b6f05c26d5cfadd0a2d165580d -> 2573aff25d9f773249ecd790af3a232de6397f46 (pr/ipc-win.21 -> pr/ipc-win.22, compare)<!-- end --> fixing bitcoin.exe wrapper exiting after spawning subprocesses to fix functional tests failures in windows cross-compiled binaries test https://github.com/bitcoin/bitcoin/actions/runs/24686166591/job/72198932709?pr=32387 and also adding better mpgen exception handling to determine why Windows native VS job still fails on windows, since it is still just exiting with code -1073740791 (STATUS_FAIL_FAST_EXCEPTION)

    <!-- begin push-23 -->

    Updated 2573aff25d9f773249ecd790af3a232de6397f46 -> 13de58e1b5ec29d0db22073faa3d5eee36a03616 (pr/ipc-win.22 -> pr/ipc-win.23, compare)<!-- end --> changing the way mpgen tool locates capnproto binaries to fix mpgen errors in https://github.com/bitcoin/bitcoin/actions/runs/24695410947/job/72226931947?pr=32387 and fixing the way socket error codes are translated to try to get better functional tests errors than "error: timeout on transient error: The operation completed successfully" in https://github.com/bitcoin/bitcoin/pull/32387

  17. ryanofsky force-pushed on May 6, 2025
  18. ?
    added_to_project_v2 fanquake
  19. ?
    project_v2_item_status_changed fanquake
  20. DrahtBot added the label Needs rebase on May 20, 2025
  21. ryanofsky referenced this in commit 7d9789401b on Aug 20, 2025
  22. ryanofsky force-pushed on Oct 15, 2025
  23. ryanofsky referenced this in commit 0f75629bc5 on Oct 22, 2025
  24. ryanofsky referenced this in commit 7d2f3c4371 on Oct 22, 2025
  25. ryanofsky force-pushed on Oct 22, 2025
  26. ryanofsky renamed this:
    [DRAFT] ipc: add windows support
    ipc: add windows support
    on Oct 22, 2025
  27. DrahtBot removed the label Needs rebase on Oct 22, 2025
  28. DrahtBot added the label Needs rebase on Dec 2, 2025
  29. ryanofsky force-pushed on Dec 12, 2025
  30. DrahtBot removed the label Needs rebase on Dec 12, 2025
  31. DrahtBot added the label CI failed on Dec 12, 2025
  32. DrahtBot commented at 4:18 PM on December 12, 2025: contributor

    <!--85328a0da195eb286784d51f73fa0af9-->

    🚧 At least one of the CI tasks failed. <sub>Task No wallet: https://github.com/bitcoin/bitcoin/actions/runs/20166538974/job/57891563544</sub> <sub>LLM reason (✨ experimental): Compilation failure: missing mp::Stream and mp::SocketId types (making CapnpProtocol abstract and uninstantiable).</sub>

    <details><summary>Hints</summary>

    Try to run the tests locally, according to the documentation. However, a CI failure may still happen due to a number of reasons, for example:

    • Possibly due to a silent merge conflict (the changes in this pull request being incompatible with the current code in the target branch). If so, make sure to rebase on the latest commit of the target branch.

    • A sanitizer issue, which can only be found by compiling with the sanitizer and running the affected test.

    • An intermittent issue.

    Leave a comment here, if you need help tracking down a confusing failure.

    </details>

  33. ryanofsky referenced this in commit 2975facdd1 on Apr 3, 2026
  34. ryanofsky referenced this in commit 070e0d1cc8 on Apr 3, 2026
  35. ryanofsky referenced this in commit 869691cc12 on Apr 15, 2026
  36. ryanofsky force-pushed on Apr 15, 2026
  37. ipc, moveonly: combine ipc_test.cpp and ipc_tests.cpp
    Previously ipc_test.cpp contained tests which depended on
    libmultiprocess and ipc_tests.cpp contained tests which didn't.
    Separation was needed because libmultiprocess tests need to be built
    with additional include and link paths, and cmake only has good support
    for setting these on libraries, not source files. The separation also
    allowed the add_boost_test custom cmake function to work with no changes,
    because it could find the boost test registration in ipc_tests.cpp, and
    then ipc_tests.cpp would run the tests in ipc_test.cpp without them
    needing to be registered in boost.
    
    But with windows support being added, the parse address test can't
    easily avoid a dependecy on libmultiprocess, because it depends on the
    ipc/process.h header, and ipc/process.h header will now need
    platform-specific ProcessId and SocketId types defined by
    libmultiprocess, rather than plain ints.
    
    With all ipc tests depending on libmultiprocess, there is not really a
    rationale for having separate test files anymore, so this change
    combines them, and move the cmake add_boost_test function definition so
    it can be used instead of target_sources to register ipc_tests.cpp with
    ctest.
    
    The change prevents CI errors from including ipc/process.h in
    ipc_tests.cpp:
    
    In file included from /Users/runner/work/bitcoin/bitcoin/repo_archive/src/ipc/test/ipc_tests.cpp:5:
    In file included from /Users/runner/work/bitcoin/bitcoin/repo_archive/src/ipc/process.h:11:
    /Users/runner/work/bitcoin/bitcoin/repo_archive/src/ipc/util.h:14:10: fatal error: 'kj/debug.h' file not found
       14 | #include <kj/debug.h>
    
    https://github.com/bitcoin/bitcoin/actions/runs/24465865499/job/71492617687?pr=35084
    968ad00408
  38. ipc, refactor: Drop connect/listen/serve exe_name parameters
    Pass exe_name parameter to ipc::Protocol class constructor instead. It never
    really made sense to have exe parameters as part of the protocol interface and
    removing them makes adding new features like windows support easier.
    
    The exe name values are only used for logging and debuggging purposes to
    distinguish log messages from different processes.
    4f900a1eeb
  39. ipc, refactor: Change Protocol class field order
    This just changes Protocol class field order to make sure class members are not
    destroyed before the event loop thread exits. There is no change in behavior.
    The change is just being made to clarify intent and avoid potential bugs.
    b1790bd39e
  40. ipc, refactor: use native path separators in test
    Avoid hardcoded forward slashes is ParseAddress test, use native path
    separators instead.
    0691629c0c
  41. ipc, refactor: fix include order
    Keep standard headers separate from posix headers
    3e76d1db2f
  42. ipc, refactor: Add ProcessId type alias and use it
    Use ProcessId type instead of int to represent process ids to be
    compatible with an upcoming version of libmultiprocess which adds
    windows support.
    0009a87068
  43. ipc, refactor: Add SocketId type alias and use it
    Use SocketId type instead of int to represent socket ids to be
    compatible with an upcoming version of libmultiprocess which adds
    windows support.
    41a346ed03
  44. ipc, refactor: Add ConnectInfo type alias and use it
    Use ConnectInfo type instead of int to represent socket ids that are
    passed between processes, to be compatible with an upcoming version of
    libmultiprocess which adds windows support.
    349df1f25e
  45. ipc, refactor: Add Stream type alias and use it
    Use Stream type to abstract socket ids and be compatible with updated
    mp::ConnectStream() and mp::ServeStream() functions that use streams
    instead of socket ids in an upcoming version of libmultiprocess which
    adds windows support.
    
    Since creating Stream objects from socket ids can require the event loop
    to be running, the ipc::Protocol::serve() method is also updated to
    accept the server stream though a callback parameter instead of a normal
    parameter.
    1a97f072f8
  46. doc: Bump version 11 > 12 24e30c5b06
  47. util, refactor: Add ProcessId type alias and use it
    Add ProcessId = int type alias and apply it to WaitProcess, SpawnProcess
    (pid output argument), and callers.
    ccb804d81b
  48. util, refactor: Add SocketId type alias and use it
    Add SocketId = int and SocketError = -1 type aliases and apply SocketId
    to SpawnProcess (return type and callback parameter) and callers.
    4b1e993bb3
  49. util, refactor: Add ConnectInfo type alias and use it
    Add ConnectInfo type alias to pass socket handle from parent process to
    child process in more platform independent way.
    9d09763c3e
  50. ryanofsky force-pushed on Apr 16, 2026
  51. ryanofsky force-pushed on Apr 17, 2026
  52. ryanofsky force-pushed on Apr 17, 2026
  53. ryanofsky force-pushed on Apr 17, 2026
  54. ryanofsky force-pushed on Apr 17, 2026
  55. ryanofsky force-pushed on Apr 17, 2026
  56. ryanofsky force-pushed on Apr 17, 2026
  57. util: Handle forking inside ExecProcess
    gen.cpp used fork() directly via <unistd.h> to invoke the capnp compiler as a
    subprocess, but fork() is not available on Windows, so shouldn't be used in
    application code.
    
    Add an ExecProcess(const std::vector<std::string>& args) function to
    util.h/util.cpp that spawns a process and returns its ProcessId, leaving
    the caller responsible for WaitProcess. On POSIX it uses fork() (via
    KJ_SYSCALL) + execvp; on Windows it can use CreateProcess.
    
    Update gen.cpp to replace the inline fork/exec/wait with
    mp::WaitProcess(mp::ExecProcess(args)).
    
    Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
    b29ebce022
  58. proxy, refactor: Replace EventLoop wakeup fd integers with KJ stream objects
    Replace the m_wait_fd/m_post_fd raw int members with
    m_wait_stream/m_post_stream kj::Own<kj::AsyncIoStream> and
    m_post_writer kj::Own<kj::OutputStream>.
    
    The constructor uses provider->newTwoWayPipe() instead of calling
    socketpair() directly. The loop() and post() methods write through
    m_post_writer instead of calling write() with a raw fd, and
    EventLoopRef::reset does the same.
    2748516163
  59. cmake: Bump minimum required Cap'n Proto version to 0.9
    kj::AsyncIoStream::getFd() was added in capnproto 0.9 (commit
    d27bfb8a4175b32b783de68d93dd1dbafadddea5, first released in 0.9.0). The
    code now uses getFd() in proxy.cpp, so 0.7 is no longer a sufficient
    minimum.
    
    Set olddeps version to 0.9.2, which is the patched 0.9.x release for
    CVE-2022-46149.
    
    Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
    f300d8dc46
  60. util, refactor: Add SocketPair() and use it in SpawnProcess
    Extract socket pair creation from SpawnProcess into a standalone
    SocketPair() function, and use it to replace the inline socketpair()
    call. No behavior change.
    d42e1397bb
  61. util: Clear FD_CLOEXEC on child socket before exec
    Explicitly clear FD_CLOEXEC on the child's socket before calling exec,
    so the fd survives into the spawned process regardless of how the socket
    was created. Previously this relied on socketpair() not setting
    FD_CLOEXEC by default, which is not guaranteed if the caller creates
    sockets with SOCK_CLOEXEC or if the flag gets set by other means.
    00ba11b4e7
  62. proxy, refactor: Change ConnectStream and ServeStream to accept stream objects
    Instead of accepting raw file descriptor integers and wrapping them
    internally, ConnectStream and ServeStream now accept
    kj::Own<kj::AsyncIoStream> directly. This removes the assumption that
    the transport is always a local unix fd, making the API easier to adapt
    to other I/O types (e.g. Windows handles).
    
    The Stream type alias (kj::Own<kj::AsyncIoStream>) is added as a
    convenience, along with StreamSocketId() to extract the underlying fd
    from a Stream when needed.
    
    Callers are updated to wrap their fd with wrapSocketFd() before calling.
    6dd6e63c31
  63. proxy: Call shutdownWrite() in Connection destructor
    Flush pending Cap'n Proto release messages before closing the stream.
    When one side of a socket pair closes, the other side does not receive
    an onDisconnect event, so it relies on receiving release messages from
    the closing side to free its ProxyServer objects and shut down cleanly.
    Without this, Server objects are not freed by Cap'n Proto on
    disconnection.
    9e76c06acf
  64. util: Add Windows support
    Add Windows-specific code to support building and running on Windows:
    
    - util.h: Guard ProcessId/SocketId/SocketError type aliases with WIN32
      ifdefs so they use SOCKET/uintptr_t on Windows and int on Unix.
      Add winsock2.h include on Windows.
    - util.cpp: Guard Unix-specific system headers with WIN32 ifdefs. Add
      Windows-specific includes (windows.h, winsock2.h). Guard MaxFd() with
      #ifndef WIN32. Add GetCurrentThreadId() branch in ThreadName(). Add
      win32Socketpair() forward-declare. Add Windows branch in SocketPair()
      using win32Socketpair(). Add CommandLineFromArgv() helper needed to
      construct CreateProcess command lines. Add Windows branch in
      SpawnProcess() using named pipes and WSADuplicateSocket to pass socket
      to child. Add Windows branch in StartSpawned() reading socket from
      named pipe. Add Windows branch in WaitProcess() using
      WaitForSingleObject/GetExitCodeProcess.
    - proxy-io.h: Add Windows branch in StreamSocketId() using
      getWin32Handle().
    - proxy.cpp: Add SocketOutputStream class on Windows (analogous to
      FdOutputStream but using SOCKET/send()). Add Windows branch in
      EventLoop constructor to create m_post_writer using SocketOutputStream.
    b2fc43a57c
  65. util: drop POSIX/pthread dependencies to enable MSVC builds
    Remove POSIX and pthread calls from util.cpp to avoid relying on MinGW's POSIX
    compatibility layer. This lets code be compiled with MSVC.
    d7dee5eacc
  66. util: Fix PtrOrValue constructor for move-only types on MSVC
    MSVC error when building multiprocess.vcxproj:
    
      mp/util.h(146,46): error C2280:
        'std::variant<T *,T>::variant(const std::variant<T *,T> &)':
        attempting to reference a deleted function [with T=mp::Lock]
    
    The PtrOrValue constructor used a ternary expression to initialize data:
    
      data(ptr ? ptr : std::variant<T*, T>{std::in_place_type<T>, args...})
    
    Both arms are prvalues of type std::variant<T*,T>, so under C++17's
    mandatory copy elision no copy/move constructor should be invoked. GCC
    and Clang apply this correctly. MSVC does not apply guaranteed copy
    elision to ternary expressions in this context: it materializes the
    temporary and then attempts to copy-construct data from it. Since
    std::variant<Lock*,Lock> has a deleted copy constructor (Lock holds a
    std::unique_lock which is move-only), MSVC fails.
    
    Fix by initializing data to hold T*=ptr in the member initializer list,
    then emplacing T in-place in the constructor body if ptr is null. This
    avoids the ternary entirely and requires only the in-place constructor
    of T, not any variant copy or move.
    
    Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
    0a071648f1
  67. ci: Check out bitcoin/bitcoin PR #35084 instead of master
    This repo has introduced API changes to add Windows support to
    libmultiprocess (HANDLE-based IPC alongside the existing fd-based IPC).
    These changes require corresponding updates to Bitcoin Core, which are
    pending in bitcoin/bitcoin#35084. Until that PR merges, the Bitcoin Core
    CI jobs fail against master because Bitcoin Core has not yet been updated
    to use the new API.
    
    Switch the Bitcoin Core checkout in both jobs to use
    refs/pull/35084/merge so CI tests against the compatible version. A
    BITCOIN_CORE_REF env var is introduced at the top of the file; once
    (and keep the var in place for any future API compatibility cycles).
    
    Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
    323eb3a169
  68. proxy: Fix shutdownWrite() exception handling on macOS with dynamic libraries
    On macOS, when libcapnp is built as a dynamic library and Bitcoin Core
    REDUCE_EXPORT option is used the RTTI typeinfo for kj::Exception has a
    different address in libcapnp.dylib versus the calling binary. This
    means catch (const kj::Exception& e) in the calling binary silently
    fails to match exceptions thrown by capnp, so the DISCONNECTED exception
    from shutdownWrite() propagates as a fatal uncaught exception instead of
    being suppressed as intended.
    
    This causes the Bitcoin Core macOS native CI job to fail with:
      Fatal uncaught kj::Exception: kj/async-io-unix.c++:491: disconnected:
        shutdown(fd, SHUT_WR): Socket is not connected
    
    The fix is to use kj::runCatchingExceptions/kj::throwRecoverableException,
    which use KJ's own thread-level exception interception mechanism rather
    than C++ RTTI-based matching, and therefore work correctly across dynamic
    library boundaries. This is the same approach used elsewhere in the
    codebase (proxy.cpp EventLoop::post, type-context.h server request handler)
    for the same reason.
    
    Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
    bbf3549ecb
  69. ryanofsky force-pushed on Apr 17, 2026
  70. ryanofsky force-pushed on Apr 17, 2026
  71. ryanofsky force-pushed on Apr 20, 2026
  72. Sjors referenced this in commit d42af54c56 on Apr 20, 2026
  73. Sjors referenced this in commit 7de24f776c on Apr 20, 2026
  74. Sjors referenced this in commit 2f549eb17d on Apr 20, 2026
  75. ipc: Wrap mpgen main() in try-catch to print errors on MSVC
    On MSVC, std::terminate() does not print the exception message before
    calling abort()/fastfail, so exceptions thrown during mpgen execution
    appear as a bare 0xC0000409 exit code with no diagnostic output. Wrap
    main() in a try-catch to explicitly print the error to stderr and
    return 1 instead of crashing.
    
    Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
    ecc81da92e
  76. doc: Remove trailing whitespace
    Bitcoin Core linter rejects it:
    https://github.com/bitcoin/bitcoin/actions/runs/24568789956/job/71835997334?pr=32387
    441b467977
  77. ryanofsky force-pushed on Apr 20, 2026
  78. ipc: Replace capnp_PREFIX path construction with cmake-provided symbols
    Use target_compile_definitions on mpgen to expose CAPNP_EXECUTABLE,
    CAPNPC_CXX_EXECUTABLE (via $<TARGET_FILE:...> generator expressions on
    the CapnProto::capnp_tool and CapnProto::capnpc_cpp imported targets),
    and CAPNP_INCLUDE_DIRS (from the CAPNP_INCLUDE_DIRS variable set by
    find_package). gen.cpp uses these directly instead of constructing paths
    from capnp_PREFIX. Remove capnp_PREFIX from config.h.in as it is no
    longer needed there. Add compat fallbacks in compat_config.cmake to
    synthesize the tool imported targets and CAPNP_INCLUDE_DIRS from older
    variables when using an older CapnProto package.
    
    Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
    bca7f2aa76
  79. ipc: Windows + ENABLE_IPC build fixes
    Various small fixes for making ENABLE_IPC build work on windows.
    dea201cb66
  80. ipc: Fix windows socket error formatting 2ddb4fc3d0
  81. util: Fix ExecVp on Windows to wait for child process and return exit code
    On Windows, _wexecvp (like all _exec* variants in the MSVC CRT) works by
    calling CreateProcess to start the child, then immediately calling
    ExitProcess(0) on the parent. Unlike POSIX execvp, which replaces the
    current process image so the parent's PID becomes the child, this means
    the child is orphaned from the original caller's perspective: the shell
    or test framework waiting on bitcoin.exe sees it exit with code 0 while
    bitcoind.exe continues running in the background independently.
    
    This breaks functional tests that invoke bitcoin.exe as a wrapper (e.g.
    `bitcoin node -regtest`) because the test process has no way to wait for
    the node to stop or retrieve its exit code.
    
    Fix by switching to _wspawnvp(_P_WAIT, ...), which spawns the child and
    blocks until it exits, then calling _exit() with the child's exit code.
    From the caller's perspective ExecVp still never returns on success (the
    parent process exits inside it), so call sites don't need to change. On
    error the existing errno / -1 return convention is preserved.
    
    Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
    59aa58cbec
  82. test: Enable tool_bitcoin.py test on Windows
    Now that util::ExecVp on Windows uses _wspawnvp(_P_WAIT) instead of
    _wexecvp, the bitcoin wrapper process blocks until the child exits and
    Python can capture its stdout/stderr and exit code normally. Remove the
    Windows skip added in #33229.
    
    Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
    b6df5d3c5b
  83. cmake: Add add_windows_exe_resources() for Windows exe manifest/version
    Add a helper function that generates a target-specific resource file from a
    template and links it along with an application manifest, replacing the static
    per-binary *-res.rc files previously used by non-GUI executables and the
    bitcoin-qt-res.rc previously used by GUI executables.
    
    The new add_windows_exe_resources(target description [ICON_DIR dir]) function
    in AddWindowsResources.cmake handles both GUI and non-GUI executables through a
    single cmake/windows-res.rc.in template. When ICON_DIR is provided, the
    function prepends icon declarations to the generated RC file and sets
    ProductName to the project name, matching the previous GUI-specific behavior.
    
    Also adds the missing add_windows_exe_resources() call for bitcoin-node, which
    previously had no resource section and caused the Windows CI manifest
    validation check (mt.exe -validate_manifest) to fail.
    
    Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
    852c811c26
  84. ipc: enable by default in windows builds f247eb585e
  85. ci: Enable IPC in Windows cross-compiled CI jobs
    Remove -DENABLE_IPC=OFF from both win64 cross-build environment files
    and install pycapnp in the Windows cross-build test runner. The
    depends/ system already builds capnp for the MinGW target (NO_IPC is
    not set), so cmake will find it via the toolchain file. This lets
    interface_ipc.py and related tests run in the "Windows, test
    cross-built" CI jobs.
    
    Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
    94944eb0a7
  86. ci: Install capnproto via vcpkg and pycapnp for Windows IPC support
    Add an "ipc" feature to vcpkg.json with capnproto as a dependency and
    include it in default-features, so the Windows native VS CI job installs
    capnproto when ENABLE_IPC is ON (the default). The fuzz build already
    uses VCPKG_MANIFEST_NO_DEFAULT_FEATURES=ON, so it is unaffected.
    
    Also install pycapnp in ci-windows.py alongside pyzmq so the IPC
    functional tests (interface_ipc.py) have their required Python library,
    matching what every other CI platform already does.
    
    Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
    7d129f346b
  87. lint: Skip subtree check for src/ipc/libmultiprocess
    WARNING: DO NOT MERGE — this draft PR modifies the libmultiprocess
    subtree directly (intentionally, for testing purposes) which causes
    the subtree link check to fail. Disabling the check here to avoid
    masking unrelated lint failures while the PR is open for testing.
    
    Restore the omitted entry before any merge attempt.
    
    Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
    13de58e1b5
  88. ryanofsky force-pushed on Apr 21, 2026
  89. Sjors referenced this in commit baf5d5e571 on Apr 23, 2026
  90. Sjors referenced this in commit 36b415c486 on Apr 23, 2026
  91. Sjors referenced this in commit a20bfd86d2 on Apr 23, 2026

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: 2026-05-02 15:12 UTC

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