ipc: add windows support #32387

pull ryanofsky wants to merge 30 commits into bitcoin:master from ryanofsky:pr/ipc-win changing 90 files +2274 −775
  1. 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 and AI policy 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:

    • #36106 (bitcoin wrapper: respect CMAKE_INSTALL_BINDIR/LIBEXECDIR by ryanofsky)
    • #36105 (bitcoin wrapper: Fix Windows exec so wrapper waits for child process by ryanofsky)
    • #36097 (mining: replace interrupt methods with cancellation arguments by xyzconstant)
    • #36087 (util: Add and use AssertUnreachable by maflcko)
    • #36060 (build: require KJ exception support for IPC by 151henry151)
    • #35932 (ipc: make ipc::disconnectIncoming wait for in-progress calls to complete by ryanofsky)
    • #35916 (fuzz: improve ipc fuzz coverage by enirox001)
    • #35911 (Warn on and add missing [[noreturn]] by fanquake)
    • #35511 (RFC: consensus: Make CAmount a class by hodlinator)
    • #33593 (guix: Use UCRT runtime for Windows release binaries by hebasto)
    • #31507 (build: Use clang-cl to build on Windows natively by hebasto)

    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 typos and grammar issues:

    • It it possible to obtain the actual process ID... -> It is possible to obtain the actual process ID... [duplicate “it” breaks the sentence]
    • It safe to access post_writer here... -> It is safe to access post_writer here... [missing “is”]

    <sup>2026-08-15 01:15:22</sup>

  2. ryanofsky force-pushed on Apr 30, 2025
  3. 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

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

    Concept ACK.

  5. DrahtBot added the label CI failed on Apr 30, 2025
  6. 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>

  7. 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
  8. ryanofsky force-pushed on Apr 30, 2025
  9. 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.

  10. ryanofsky force-pushed on May 1, 2025
  11. DrahtBot removed the label CI failed on May 1, 2025
  12. ryanofsky force-pushed on May 2, 2025
  13. 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.
  14. ryanofsky force-pushed on May 6, 2025
  15. 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

  16. ryanofsky force-pushed on May 6, 2025
  17. fanquake added this to a project on May 10, 2025
  18. fanquake changed the project status on May 10, 2025
  19. DrahtBot added the label Needs rebase on May 20, 2025
  20. ryanofsky referenced this in commit 7d9789401b on Aug 20, 2025
  21. ryanofsky force-pushed on Oct 15, 2025
  22. ryanofsky referenced this in commit 0f75629bc5 on Oct 22, 2025
  23. ryanofsky referenced this in commit 7d2f3c4371 on Oct 22, 2025
  24. ryanofsky force-pushed on Oct 22, 2025
  25. ryanofsky renamed this:
    [DRAFT] ipc: add windows support
    ipc: add windows support
    on Oct 22, 2025
  26. DrahtBot removed the label Needs rebase on Oct 22, 2025
  27. DrahtBot added the label Needs rebase on Dec 2, 2025
  28. ryanofsky force-pushed on Dec 12, 2025
  29. DrahtBot removed the label Needs rebase on Dec 12, 2025
  30. DrahtBot added the label CI failed on Dec 12, 2025
  31. 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>

  32. ryanofsky referenced this in commit 2975facdd1 on Apr 3, 2026
  33. ryanofsky referenced this in commit 070e0d1cc8 on Apr 3, 2026
  34. ryanofsky referenced this in commit 869691cc12 on Apr 15, 2026
  35. ryanofsky force-pushed on Apr 15, 2026
  36. ryanofsky force-pushed on Apr 16, 2026
  37. ryanofsky force-pushed on Apr 17, 2026
  38. ryanofsky force-pushed on Apr 17, 2026
  39. ryanofsky force-pushed on Apr 17, 2026
  40. ryanofsky force-pushed on Apr 17, 2026
  41. ryanofsky force-pushed on Apr 17, 2026
  42. ryanofsky force-pushed on Apr 17, 2026
  43. ryanofsky force-pushed on Apr 17, 2026
  44. ryanofsky force-pushed on Apr 17, 2026
  45. ryanofsky force-pushed on Apr 20, 2026
  46. Sjors referenced this in commit d42af54c56 on Apr 20, 2026
  47. Sjors referenced this in commit 7de24f776c on Apr 20, 2026
  48. Sjors referenced this in commit 2f549eb17d on Apr 20, 2026
  49. ryanofsky force-pushed on Apr 20, 2026
  50. ryanofsky force-pushed on Apr 21, 2026
  51. Sjors referenced this in commit baf5d5e571 on Apr 23, 2026
  52. Sjors referenced this in commit 36b415c486 on Apr 23, 2026
  53. Sjors referenced this in commit a20bfd86d2 on Apr 23, 2026
  54. DrahtBot added the label Needs rebase on May 22, 2026
  55. Kino1994 referenced this in commit df4bde1ae5 on Jun 28, 2026
  56. BigcoinBGC referenced this in commit f955c0b0ed on Jun 30, 2026
  57. ryanofsky force-pushed on Jul 22, 2026
  58. ryanofsky commented at 5:38 PM on July 22, 2026: contributor

    <!-- begin push-24 -->

    Rebased 13de58e1b5ec29d0db22073faa3d5eee36a03616 -> e99cb6170e6761f1678a7e8822fc7cd9a5606b2b (pr/ipc-win.23 -> pr/ipc-win.24, compare)<!-- end --> with many new fixes on top of base PRs https://github.com/bitcoin-core/libmultiprocess/pull/231, https://github.com/bitcoin-core/libmultiprocess/pull/317, https://github.com/bitcoin-core/libmultiprocess/pull/318, and #35084, also resolving conflicts with #35661 and #35684

    <!-- begin push-25 -->

    Updated e99cb6170e6761f1678a7e8822fc7cd9a5606b2b -> aa2892e82a334b6d2998937ffab27c2a6fa889dc (pr/ipc-win.24 -> pr/ipc-win.25, compare)<!-- end --> rebasing onto latest master and fixing lint errors (trailing newline in type-unordered-set.h, commit message format) https://github.com/bitcoin/bitcoin/actions/runs/29943010623/job/89001345876

    <!-- begin push-26 -->

    Rebased aa2892e82a334b6d2998937ffab27c2a6fa889dc -> 3177fbd5f2d553325f5414232d0be90aedec2aae (pr/ipc-win.25 -> pr/ipc-win.26, compare)<!-- end --> after #35084 to fix lint: duplicate #include <cerrno> in protocol.cpp https://github.com/bitcoin/bitcoin/actions/runs/29956699510/job/89047462559, also including upstream libmultiprocess updates

    <!-- begin push-27 -->

    Updated 3177fbd5f2d553325f5414232d0be90aedec2aae -> 3a845a8be9060c6abd8bdeb2f08cb37e9371c7a9 (pr/ipc-win.26 -> pr/ipc-win.27, compare)<!-- end --> to fix Windows build: remove compatibility shim that unconditionally included sys/socket.h https://github.com/bitcoin/bitcoin/actions/runs/30702460336/job/91375771635

    <!-- begin push-28 -->

    Updated 3a845a8be9060c6abd8bdeb2f08cb37e9371c7a9 -> 399c8820ce4b6847a0dc8e2e2c2cfe0b5b7b6fda (pr/ipc-win.27 -> pr/ipc-win.28, compare)<!-- end --> updating libmultiprocess base, restructuring commits and fixing various conflicts

    <!-- begin push-29 -->

    Updated 01ac9a03b580fd8066bd18440984dfcb15958b17 -> d0863ee76db080b558df0d307d244318eb2c887c (pr/ipc-win.28 -> pr/ipc-win.29, compare)<!-- end --> to fix CI: suppress C++23 lambda attribute warnings on clang-17/MSVC, and fix unused error_fds on Windows builds https://github.com/bitcoin/bitcoin/actions/runs/31636108883/job/94246747032

    <!-- begin push-30 -->

    Updated d0863ee76db080b558df0d307d244318eb2c887c -> 8f384c9f2499a5df8588100f563d0328cf51fd17 (pr/ipc-win.29 -> pr/ipc-win.30, compare)<!-- end --> to fix mptest connect_tests race: accept either disconnect error message https://github.com/bitcoin/bitcoin/actions/runs/31655880824/job/94310097285

    <!-- begin push-31 -->

    Rebased 8f384c9f2499a5df8588100f563d0328cf51fd17 -> 62dd45984057326b410c0208a5a86fda8c0351a2 (pr/ipc-win.30 -> pr/ipc-win.31, compare)<!-- end --> due to conflicts with #35084 and #35852

  59. DrahtBot removed the label Needs rebase on Jul 22, 2026
  60. ryanofsky force-pushed on Jul 22, 2026
  61. sedited referenced this in commit a9d181f2d3 on Jul 29, 2026
  62. DrahtBot added the label Needs rebase on Jul 29, 2026
  63. ryanofsky force-pushed on Aug 1, 2026
  64. ryanofsky force-pushed on Aug 1, 2026
  65. DrahtBot removed the label Needs rebase on Aug 1, 2026
  66. DrahtBot removed the label CI failed on Aug 1, 2026
  67. DrahtBot added the label IPC on Aug 1, 2026
  68. Kino1994 referenced this in commit 33bd9b5d17 on Aug 2, 2026
  69. ryanofsky referenced this in commit abf127a314 on Aug 3, 2026
  70. DrahtBot added the label CI failed on Aug 4, 2026
  71. ryanofsky force-pushed on Aug 4, 2026
  72. DrahtBot removed the label CI failed on Aug 5, 2026
  73. DrahtBot added the label Needs rebase on Aug 7, 2026
  74. ryanofsky force-pushed on Aug 12, 2026
  75. DrahtBot removed the label Needs rebase on Aug 12, 2026
  76. DrahtBot added the label CI failed on Aug 12, 2026
  77. DrahtBot commented at 9:35 PM on August 12, 2026: contributor

    <!--85328a0da195eb286784d51f73fa0af9-->

    🚧 At least one of the CI tasks failed. <sub>Task test ancestor commits: https://github.com/bitcoin/bitcoin/actions/runs/31636108883/job/94246696076</sub> <sub>LLM reason (✨ experimental): CI failed due to a C++ build error: clang++ rejected [[noreturn]] on a lambda in mp/proxy-types.h as a C++23 extension and treated the warning as an -Werror compile failure.</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>

  78. ryanofsky force-pushed on Aug 13, 2026
  79. ryanofsky force-pushed on Aug 13, 2026
  80. DrahtBot removed the label CI failed on Aug 13, 2026
  81. DrahtBot added the label Needs rebase on Aug 14, 2026
  82. sync with libmultiprocess master
    commit 390b5f901f1336307df3da99d1ddc54fa2dbf63d
    e1936b8a19
  83. 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.
    
    Note: removing src/ipc/libmultiprocess from get_subtrees() also removes
    it from get_pathspecs_default_excludes(), so all other lint checks
    (trailing newline, whitespace, etc.) now run on files in that directory
    as well. This is why src/ipc/libmultiprocess/include/mp/type-unordered-set.h
    needs a trailing newline added here even though it is not otherwise
    modified by this PR: it has always been missing the newline, but was
    previously hidden from the lint check by the subtree exclusion.
    
    Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
    8c7741686a
  84. ipc: remove compatibility shim after libmultiprocess update 3fc753b010
  85. util: Improve SpawnProcess API and documentation
    Remove recently introduced SpawnConnectInfo and SpawnConnectInfoToArgsFn type
    aliases since they are the same on all platforms and might obscure the fact
    that connect info should be treated as an opaque string.
    
    Co-authored-by: Sjors Provoost <sjors@sprovoost.nl>
    c0db1533bc
  86. util, test: Add CloseSocket, use SocketId
    Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
    9ce64ad735
  87. util, test: Replace UnixListener with SocketListener
    Replace the Unix-only UnixListener test helper with a cross-platform
    SocketListener backed by a std::variant<sockaddr_un> (TCP arm will be
    added later for Wine compatibility).
    
    - test/socketlistener.h: New header with SocketListener class extracted from
      the pattern of UnixListener but using SocketId/SocketError types,
      std::filesystem for temp dir cleanup, and mp::CloseSocket for teardown.
      Uses std::variant<sockaddr_un> so the TCP arm can be appended later without
      restructuring the class.
    - test/unixlistener.h: Deleted.
    - test/listen_tests.cpp: Switch to socketlistener.h and socketlistener.
    - test/connect_tests.cpp: Switch to socketlistener.h and socketlistener.
    
    Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
    892f5d9711
  88. util, test: guard Unix-only code for Windows build
    Move POSIX-only headers in util.cpp into a #ifndef WIN32 block so the file
    compiles on Windows without modification. Guard the Unix-only helpers (MakeArgv,
    MaxFd, ChildFail, SpawnError*, ReadSpawnResult, WriteSpawnError, KillAndReapChild)
    with a single #ifndef WIN32 block. Guard the extern "C" environ declaration
    likewise. Guard Unix-only includes in spawn_tests.cpp and connect_tests.cpp and
    wrap the Unix-only spawn tests with #ifndef WIN32.
    
    No Windows implementations are added here; those come in a later commit.
    
    Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
    6bfb137d43
  89. util: Add Windows CommandLineFromArgv escaping function
    Co-authored-by: Sjors Provoost <sjors@sprovoost.nl>
    b9e4f3d0e6
  90. 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.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.
    
    Co-Authored-By: ViniciusCestarii <viniciuscestari01@gmail.com>
    bc7abc586e
  91. util: Fix Windows SpawnProcess hang when child exits before connecting to named pipe
    SpawnProcess on Windows creates a named pipe with PIPE_WAIT and then calls
    ConnectNamedPipe synchronously. If the child exits or crashes before
    connecting, ConnectNamedPipe blocks forever with no recovery path.
    
    Fix by opening the pipe with FILE_FLAG_OVERLAPPED and using
    WaitForMultipleObjects on both the connect event and the child process
    handle. If the process handle signals first, the child died without
    connecting and SpawnProcess throws instead of hanging. Since the pipe is
    now in overlapped mode, WriteFile also requires an OVERLAPPED structure;
    use GetOverlappedResult with bWait=TRUE to handle both synchronous and
    asynchronous completion.
    
    Add a Windows-only test that spawns a child which exits immediately
    without opening the named pipe and asserts SpawnProcess does not block.
    
    (https://github.com/bitcoin-core/libmultiprocess/pull/231#discussion_r3706021950)
    
    Co-Authored-By: ViniciusCestarii <viniciuscestari01@gmail.com>
    Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
    df65470848
  92. util: make pthreads optional on Windows to enable MSVC builds
    Allow code to compile without pthreads available, as required for MSVC
    compatibility. Avoid unconditional POSIX calls (fork, posix_spawn,
    pthread_getname_np) by moving them into #ifndef WIN32 or HAVE_PTHREAD_*
    guards. When pthreads is available on Windows (detected via cmake
    HAVE_PTHREAD_* checks), still use it for thread name reporting since it
    provides useful information at low cost.
    
    Also add Threads::Threads as an explicit dependency of the multiprocess
    library. proxy.cpp directly uses thread_local, std::this_thread, and
    std::thread, and the dependency was previously satisfied only through
    transitive linkage from CapnProto::kj-async.
    
    Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
    a382d824dd
  93. test: Add TCP SocketListener and Windows compat to socketlistener.h
    Add TCP (sockaddr_in) support to SocketListener and platform-conditional
    header guards so the class compiles and works on Windows:
    
    - Wrap POSIX headers (arpa/inet.h, netinet/in.h, sys/socket.h, sys/un.h)
      in #else of #ifdef WIN32, with Windows equivalents (afunix.h,
      ws2tcpip.h) in the #ifdef WIN32 branch.
    - Add a WsaInit static initializer on Windows that calls WSAStartup
      before any socket operations. Tests create sockets directly (not via
      StartSpawned), so Winsock must be initialized here.
    - Add Init(sockaddr_in&) and Connect(const sockaddr_in&) overloads for
      TCP loopback connections.
    - Use TCP on Windows to work around Wine's lack of the AcceptEx extension
      required by KJ's AF_UNIX listener; Unix platforms continue using
      AF_UNIX.
    - Expand std::variant<sockaddr_un> to std::variant<sockaddr_in, sockaddr_un>.
    
    Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
    d75d06d1f5
  94. ci: add Windows cross-compilation config using MinGW and Wine
    - shell.nix: add `windows` parameter that selects pkgs.pkgsCross.mingwW64
      as the cross target; also change crossPkgs default from import<nixpkgs>{}
      to null (cleaner API). When windows=true, add native pkgs.capnproto to
      nativeBuildInputs so capnp/capnpc-c++ are in PATH for cmake code generation,
      and add wine64Packages.staging so ctest can run mptest.exe via wine.
      Change llvmBase to always use pkgs (native) instead of crossPkgs.
    
    - ci/configs/windows.bash: new config that cross-compiles with mingw,
      sets CMAKE_SYSTEM_NAME=Windows, CMAKE_FIND_ROOT_PATH_MODE_PROGRAM=NEVER
      (so cmake finds native capnp from PATH), CMAKE_CROSSCOMPILING_EMULATOR=wine
      (so ctest runs mptest.exe via wine), and sets MPGEN_PRE_BUILD=1.
    
    - ci/scripts/ci.sh: add MPGEN_PRE_BUILD support: when set, build native mpgen
      in $CI_DIR-native before the main cross build, then inject
      -DMPGEN_EXECUTABLE into CMAKE_ARGS. This is needed because cmake's
      add_custom_command does not use CMAKE_CROSSCOMPILING_EMULATOR, so the
      cross-compiled mpgen.exe cannot be used as a code generator directly.
    
    Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
    d5a9945873
  95. workaround: MinGW thread_local use-after-free in ThreadContext
    MinGW has a bug where thread_local destructors can run on already-freed memory
    at thread exit, causing heap corruption. MSVC builds and non-Windows platforms
    are unaffected.
    
    This caused intermittent STATUS_HEAP_CORRUPTION in MinGW CI builds when
    ~ThreadContext walked freed memory at thread exit. See CurrentThread() in
    proxy-io.h for the full explanation and upstream bug references.
    
    Workaround: change CurrentThread() accessor in MinGW builds to return a
    heap-allocated object held by a trivially-destructible pointer, skipping
    destructor registration at thread exit. The object is deliberately
    leaked.
    
    Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
    4e9cf615db
  96. ipc: Windows + ENABLE_IPC build fixes
    Various small fixes for making ENABLE_IPC build work on windows.
    4c515ac73f
  97. ipc: Fix MSVC build error C3861 in ipc_tests.cpp
    MSVC does not provide mkstemp (a POSIX function available in MinGW but
    not the MSVC runtime), causing:
    
      error C3861: 'mkstemp': identifier not found
      error C4996: 'close': The POSIX name for this item is deprecated
    
    Fix by using _mktemp_s on WIN32, which fills in the XXXXXX suffix
    in-place without creating a file (so no fd to close or file to remove).
    
    Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
    8e47ce5c63
  98. ipc: Fix windows socket error formatting 13f8b779be
  99. ipc: Fix Windows connect() error for missing Unix socket path
    On Windows, connect() to a Unix domain socket path that doesn't exist
    may return a WSA error code (e.g. WSAECONNREFUSED) that doesn't map to
    std::errc::no_such_file_or_directory via std::system_category(), unlike
    POSIX where ENOENT is returned. After a failed connect, explicitly check
    if the socket path exists and throw the expected error if not.
    
    Also add an fs::exists(path, ec) overload to fs.h: the file's existing
    exists() wrappers shadow std::filesystem::exists(path, error_code&),
    causing the new call in process.cpp to fail to compile under MinGW.
    
    Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
    a276f29872
  100. ipc: Work around MinGW system_category() not mapping WSAECONNREFUSED
    When the IPC socket file exists but no node is listening, ProcessImpl::connect
    throws std::system_error(WSAECONNREFUSED, std::system_category()). MinGW
    libstdc++'s system_category() does not map Winsock error values to std::errc
    conditions, so the std::errc::connection_refused check in connectAddress fails
    to catch it, and bitcoin-cli -ipcconnect=auto throws CConnectionFailed instead
    of falling back to HTTP.
    
    This is a workaround: the proper fix is for ProcessImpl::connect to throw
    std::errc::connection_refused (using generic_category) rather than relying on
    system_category() to map Winsock codes. As a workaround, check for
    WSAECONNREFUSED explicitly in system_category on WIN32.
    
    MSVC's STL does map WSAECONNREFUSED to errc::connection_refused, so this
    check is redundant but harmless there.
    
    Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
    5c4fdfaef9
  101. ipc: Skip MAX_DOUBLE static_assert on MSVC to fix C2131
    Bug: MSVC C2131 "expression did not evaluate to a constant" on line:
      static_assert(ipc::capnp::messages::MAX_DOUBLE == std::numeric_limits<double>::max())
    
    Root cause: Capnp floating-point constants can't be constexpr on MSVC.
    In capnp's generated-header-support.h, CAPNP_NON_INT_CONSTEXPR_DECL_INIT
    is defined as empty on MSVC (with the comment "MSVC doesn't understand
    floating-point constexpr yet"), so MAX_DOUBLE is declared as
    `static const double MAX_DOUBLE;` without an initializer in the header.
    A `const double` (unlike `const int`) is not a constant expression in C++,
    so it can't be used in static_assert on MSVC.
    
    Fix: Guard with `#if !defined(_MSC_VER) || defined(__clang__)` to match
    the exact condition capnp itself uses for the same limitation. The other
    three static_asserts in the same block use integer constants (MAX_MONEY,
    DEFAULT_BLOCK_RESERVED_WEIGHT, DEFAULT_COINBASE_OUTPUT_MAX_ADDITIONAL_SIGOPS)
    which don't have this MSVC limitation and continue to run.
    
    Alternatives considered:
    - Convert to a runtime BOOST_CHECK: would require moving into a test
      function, more invasive change.
    - Use std::numeric_limits<double>::max() literal: wouldn't help since
      MAX_DOUBLE is the non-constexpr side.
    
    Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
    b66a6dceaa
  102. 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>
    e76d83bd1e
  103. bitcoin: Fix IPC child process exec on Windows due to missing .exe extension
    _wspawnvp (the Windows implementation of ExecVp) requires the full filename
    including ".exe" when given an explicit path. Unlike POSIX execvp, it does
    not add the extension automatically.
    
    Also, msvcrt's _wspawnvp returns EINVAL (not ENOENT) when a file is not
    found — both when ".exe" is absent and when the file simply doesn't exist.
    ucrt returns ENOENT correctly. The allow_notfound check in try_exec only
    caught ENOENT, so on msvcrt it never fell through to the next search path.
    
    Without both fixes, all IPC functional tests failed immediately with:
      "execvp failed to execute '...\libexec\bitcoin-node': Invalid argument"
    
    Fix: append ".exe" when the path has no extension, and catch both ENOENT
    and EINVAL as "file not found" on WIN32.
    
    Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
    1bb9ee9649
  104. 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>
    a09413f767
  105. test: Add Windows AF_UNIX asyncio support to ipc_util.py
    Python's asyncio doesn't support create_unix_connection() on Windows. Implement
    it by patching asyncio.ProactorEventLoop, using ctypes ws2_32.connect() and
    a non-blocking select() loop. See ipc_util.py for details on why each of those
    choices was necessary.
    
    Also: run blocking do_fn() callables in run_in_executor() in wait_and_do();
    unlink stale AF_UNIX socket files before node restart on Windows (test_node.py);
    set UNIX_PATH_MAX = 108 for Windows (test_node.py); catch OSError in the
    connection retry loop in interface_ipc_mining.py.
    
    Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
    3b08458514
  106. test: Fix interface_ipc_cli.py error assertions on Windows
    On POSIX, connect() to a stopped node returns ECONNREFUSED and bitcoin-cli
    prints "error: Connection refused" followed by help text. On Windows the
    equivalent WSAECONNREFUSED produces a different OS error string without help
    text. Fix the expected string and switch to a prefix match since the Windows
    message has no appended help text.
    
    Also, on Windows, bitcoind removes the IPC socket file on clean shutdown
    (unlike Linux where the file persists and connect() returns ECONNREFUSED).
    A subsequent connect attempt sees ENOENT ("No such file or directory").
    Update test_cli() to accept a tuple of alternative prefixes and use a
    two-entry tuple for the Windows case covering both error strings.
    
    Also add diagnostic logging retained for future debugging: ipc_socket_path
    in both backslash and forward-slash forms with encoded byte length (to
    diagnose MinGW path format issues), socket file existence before each
    explicit-path test, and per-call debug logging of returncode and stdout.
    
    Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
    aec9866be4
  107. 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>
    114efb2e00
  108. ipc: enable by default in windows builds 145489c7f0
  109. 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>
    0e53b3a120
  110. 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>
    95750767c2
  111. ci: Add missing ipc and tests vcpkg features to Windows fuzz build
    The fuzz build in ci-windows.py set -DVCPKG_MANIFEST_FEATURES=wallet but
    omitted ipc and tests, so vcpkg installed wallet dependencies but not
    capnproto. The build then failed with:
      "Cap'n Proto is required but was not found"
    
    Fix: extend VCPKG_MANIFEST_FEATURES to ipc;tests;wallet.
    
    Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
    62dd459840
  112. ryanofsky force-pushed on Aug 15, 2026
  113. DrahtBot removed the label Needs rebase on Aug 15, 2026
  114. Kino1994 referenced this in commit 23854f0cec on Aug 19, 2026
  115. Kino1994 referenced this in commit 0a4ead0267 on Aug 19, 2026
  116. Sjors referenced this in commit 1d2ea2d265 on Aug 20, 2026
  117. Sjors referenced this in commit eba772de2c on Aug 20, 2026
  118. Sjors referenced this in commit c5809dc123 on Aug 20, 2026
  119. Sjors referenced this in commit b0efdd6f4e on Aug 20, 2026
  120. Sjors referenced this in commit c52dc06071 on Aug 21, 2026
  121. Sjors referenced this in commit 20b1d99d47 on Aug 21, 2026
  122. Sjors referenced this in commit 114c7d49f0 on Aug 21, 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-08-31 19:51 UTC

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