Update libmultiprocess subtree to add nonunix platform support and fix race conditions #36747

pull ryanofsky wants to merge 3 commits into bitcoin:master from ryanofsky:pr/subtree-15 changing 67 files +1645 −544
  1. ryanofsky commented at 5:23 PM on November 3, 2026: contributor

    The changes can be verified by running test/lint/git-subtree-check.sh src/ipc/libmultiprocess as described in developer notes and lint instructions.

    Changes since last subtree update (#35720):

    • Adds support for nonunix platforms, making API changes that are not backwards compatible (#274). Follow-ups add a CurrentThread() accessor matching compatibility code in bitcoin/bitcoin#35084 (#323) and remove code for Cap'n Proto versions before 0.9 (#331).
    • Fixes a data race between IPC calls running on worker threads and disconnects, found by Antithesis (#349).
    • Fixes a use-after-free when a socket disconnects before ConnectStream connects, and leaks and hangs when a client construct() call throws (#298).
    • Fixes a race where file descriptors from SpawnProcess could leak into processes forked at the same time by other threads, by clearing FD_CLOEXEC in the child after forking (#311).
    • Makes SpawnProcess report exec failures back to the parent and throw, reaping the child (#312).
    • Adds support for std::chrono::time_point fields (#303) and for serializing lists of interface objects that need to be moved from (#304), both needed by bitcoin/bitcoin#10102.
    • Accepts container fields and parameters with any comparator, hash, and allocator types, like Bitcoin Core's GCSFilter::ElementSet, needed by bitcoin/bitcoin#29409 (#379).
    • Finds the capnp tool in vcpkg and Windows builds, needed by bitcoin/bitcoin#32387 (#317).
    • Replaces EventLoop::post() with sync() taking a kj::FunctionParam, avoiding a heap allocation per call (#347).
    • Names threads spawned by the event loop so they can be told apart in tools and logs (#324).
    • Fixes warnings that Bitcoin Core enables or plans to enable: adds [[noreturn]] attributes for -Wmissing-noreturn (#339, for bitcoin/bitcoin#35911), and fixes -Wunused (#362, for bitcoin/bitcoin#36167), -Wunused-const-variable and -Wundef (#370), and -Wmissing-prototypes (#386, for bitcoin/bitcoin#36743) warnings.
    • Fails at compile time with a suggested workaround when Cap'n Proto misdetects exception support (KJ_NO_EXCEPTIONS), as happens on NetBSD (#364).
    • Build improvements: fixes stale generated code when the mpgen binary changes (#316), fixes mpgen link order for static Cap'n Proto builds (#367), links mpgen against kj-async instead of capnp-rpc (#327), shows Cap'n Proto find_package diagnostics (#325), installs type-unordered-set.h and version.h (#350), and shows include-what-you-use errors instead of failing silently (#371).
    • Test, CI, documentation, and minor code improvements: fix for a startup race in the example program (#315), new test for immediate client disconnects in ListenConnections (#310), ReadList return value check (#338), connect test race fix (#343) and cleanups (#344), std::ranges::copy follow-ups (#307), trailing whitespace removal (#345), Cap'n Proto version documentation fix (#357), clang-tidy updates (#358, #360, #380), new CI job testing newer cmake and Cap'n Proto versions (#212, #359), CI coverage for the minimum supported g++ (#330, #366), new CI warnings (#332, #341), CI parallelism (#334, #356), CI diagnostics (#351, #352), Nix and LLVM updates (#296, #363), NetBSD and OpenBSD CI fixes (#321, #340, #381), building Cap'n Proto with GCC in the 32-bit CI job to avoid an ABI mismatch (#383), and GitHub Actions updates (#387).

    The second commit suppresses the clang -Wc++23-lambda-attributes warning and the equivalent MSVC warning C5283, which the new [[noreturn]] lambda attribute in mp/proxy-types.h triggers in C++20 builds.

  2. Squashed 'src/ipc/libmultiprocess/' changes from e8de5c7b68e..263139f41dd
    263139f41dd Merge bitcoin-core/libmultiprocess#387: ci: use newer `actions/*` versions
    388e37c5bc7 Merge bitcoin-core/libmultiprocess#386: gen: make `AccessorType` static
    81e55578047 Merge bitcoin-core/libmultiprocess#383: ci: Compile capnproto with GCC in gnu32 job
    c8ca0c0f6f1 ci: add -Wmissing-declarations to default.bash
    3edd64840d0 Merge bitcoin-core/libmultiprocess#379: type: Accept any comparator, hash, and allocator in container fields
    641c78ecacb ci: add -Wmissing-prototypes to LLVM config
    52a028c8b78 gen: make AccessorType static
    796dd742414 Merge bitcoin-core/libmultiprocess#380: .clang-tidy: Enable additional checks
    b1816a8d02a Merge bitcoin-core/libmultiprocess#362: Enable `-Wunused`
    cf2164ba0e2 ci: make curl fail more loudly
    0bce5ed7a41 ci: use newer actions/ versions
    ee8e64b87bc ci: add -Wunused to CI configs
    fd75dc66964 refactor: use requires clauses instead of SFINAE enable parameters
    0e6fffa8117 refactor: remove unused code
    fabc4901269 .clang-tidy: Enable additional modernize checks
    89bccd849ee Merge bitcoin-core/libmultiprocess#381: ci: Fix OpenBSD job
    04a0465d67a ci: Compile capnproto with GCC in gnu32 job
    1b742cfbbd7 ci: Fix OpenBSD job
    a4fa10754c7 .clang-tidy: Enable additional checks not in upstream Bitcoin Core
    7460e35896b .clang-tidy: Enable checks from upstream Bitcoin Core
    9a42d0065d9 type: Accept any comparator, hash, and allocator in container fields
    2e7812a5a1e Merge bitcoin-core/libmultiprocess#370: Fix Bitcoin Core build errors from libmultiprocess headers
    686bccf766f Merge bitcoin-core/libmultiprocess#371: cmake: Fix silent include-what-you-use failures
    f0a14754ef4 cmake: Show include-what-you-use diagnostics when it fails
    92127a984a4 cmake: Pass -w to include-what-you-use
    3577d23f616 ci: Enable -Wundef in default and llvm jobs
    debd42955ea proxy-types: Avoid -Wundef error when KJ_NO_EXCEPTIONS is not defined
    6fd2a9c90e1 Merge bitcoin-core/libmultiprocess#367: mpgen: Change Cap'n Proto link order to fix undefined references in static builds
    a8c64c7faa5 ci: Enable -Wunused-const-variable in GCC jobs
    701449c1657 util: Make SocketError inline constexpr
    f1042b1a60e Merge bitcoin-core/libmultiprocess#366: ci: Compile with minimum supported g++-10 in olddeps
    a6ecdc113ff Merge bitcoin-core/libmultiprocess#364: util: Error out at compile time if KJ_NO_EXCEPTIONS is set
    56cfdaa884e Change CapnProto library linkage for mpgen
    fa5633467af ci: Compile with minimum supported g++-10 in olddeps
    4a1f400f8b7 util: Error out at compile time if KJ_NO_EXCEPTIONS is set
    2dba130478a Merge bitcoin-core/libmultiprocess#363: ci: use LLVM 23 in Bitcoin Core CI
    161197a5c7b Merge bitcoin-core/libmultiprocess#352: ci: add cmake debug output
    fb4ac7eb8c8 ci: use LLVM 23 in Bitcoin Core CI
    7bac69de1fc Merge bitcoin-core/libmultiprocess#360: pull latest .clang-tidy from downstream
    79ddc44eb32 Merge bitcoin-core/libmultiprocess#359: ci: bump cmake version to 4.3.4 in newdeps job
    bf229bf82ae Merge bitcoin-core/libmultiprocess#351: ci: do not ignore NIXPKGS_CHANNEL in local ci runs
    073ac4f1972 Merge bitcoin-core/libmultiprocess#347: refactor: Replace EventLoop::post() with sync() taking kj::FunctionParam
    fa1db7a9e3e pull latest .clang-tidy from downstream
    5c49666a1d8 refactor: rename EventLoop::m_post_fn to m_sync_fn
    2330fbe81e2 refactor: replace EventLoop::post() with sync() taking kj::FunctionParam
    4d454a81da6 Merge bitcoin-core/libmultiprocess#358: refactor: Enable readability-container-contains
    dba99582b32 Merge bitcoin-core/libmultiprocess#357: doc: Update Cap'n Proto version to match minimum
    00923922ac3 Merge bitcoin-core/libmultiprocess#356: ci: Remove hard-coded -j4 from sanitize config
    766867fb326 ci: clarify CAPNP_CHECKOUT=master is the v1.x release branch
    cc3675280bf ci: bump cmake version to 4.3.4 in newdeps job
    fa101113b50 refactor: Enable readability-container-contains
    81f824b025f doc: Update Cap'n Proto version to match minimum
    fa30e2093c7 ci: Remove hard-coded -j4 from sanitize config
    a7ff9d5da22 ci: add cmake debug output
    f2e8df82ede Merge bitcoin-core/libmultiprocess#350: cmake: add type-unordered-set.h and version.h to public headers
    0e146c0468d Merge bitcoin-core/libmultiprocess#349: type-context: fix async disconnect race condition found by antithesis
    49f95e26326 Merge bitcoin-core/libmultiprocess#212: ci: add newdeps job testing newer versions of cmake and capnproto
    7c73cceda9b ci: rename CI-internal variables to use CI_ prefix
    fe1b8339f00 ci: do not ignore NIXPKGS_CHANNEL in local ci runs
    914dc839f27 proxy: fix data race between server request threads and disconnect handling
    275c8eefdfb Merge bitcoin-core/libmultiprocess#345: Remove trailing whitespace and Add -Wtrailing-whitespace to default ci config
    cd7162fb832 Merge bitcoin-core/libmultiprocess#304: proxy: fix BuildList to use non-const iteration for interface types
    9b136782af1 ci: Add -Wtrailing-whitespace to default config
    2f4be9ec6ea refactor: Remove trailing whitespace
    2448d282ccd cmake: add type-unordered-set.h and version.h to public headers
    b3fc922ee4a ci: add newdeps job testing newest versions of cmake and capnproto
    390b5f901f1 Merge bitcoin-core/libmultiprocess#344: test: listen_tests and connect_tests follow-ups
    d6f8588d1ab proxy: fix BuildList to use non-const iteration for interface types
    e18ca520f45 Merge bitcoin-core/libmultiprocess#343: test: fix race in connect_tests disconnect-deferred-failure test
    c39c7850c66 doc: note construct() call in valid init interface test
    b9c36c61751 test: close sockets unconditionally and check errors with KJ_SYSCALL
    7eb741e6359 test: drop unnecessary KJ_EXPECT(true)
    113f1d4d287 test: join server thread unconditionally in connect tests
    44bc4630bc1 test: drop mp:: prefixes in connect tests
    038d33eb31e test: share DefaultLogHandler between test files
    b54a1633085 test: drop TestSetup socket members in connect tests
    70467c5a727 test: add m_ prefix to TestSetup members in connect tests
    cc260f2526f test: replace capnp fix link with upstream PR
    137a6e4e039 test: fix race in connect_tests disconnect-deferred-failure test
    8dab0d4bdeb Merge bitcoin-core/libmultiprocess#341: ci: add -Wextra-semi to llvm config
    b3b134eed8b ci: add -Wextra-semi to llvm config
    bdd0cd69418 Merge bitcoin-core/libmultiprocess#339: refactor: add `[[noreturn]]` attributes
    a779a09764c ci: add -Wmissing-noreturn
    636aaff576b refactor: add missing [[noreturn]] attributes
    cc11c2b1b41 Merge bitcoin-core/libmultiprocess#338: test: check ReadList return value
    2d6e863c77a Merge bitcoin-core/libmultiprocess#334: ci: Set CMAKE_BUILD_PARALLEL_LEVEL to enable parallelism by default
    d4d10ff98ab Merge bitcoin-core/libmultiprocess#332: ci: add -Wextra-semi to default config
    b540e70f25f Merge bitcoin-core/libmultiprocess#324: proxy: Name threads spawned by the event loop
    e5e367e785c Merge bitcoin-core/libmultiprocess#312: util: report back child errors to parent and throw
    2220df68c91 Merge bitcoin-core/libmultiprocess#298: Fix error handling when creating clients (`mp::ConnectStream`)
    51defb79ef7 Merge bitcoin-core/libmultiprocess#340: ci: Update `capnproto` prerequisites on NetBSD
    7e94790b08a ci: Update `capnproto` prerequisites on NetBSD
    9f25ffca5b0 test: Cover OS thread names for worker, pool, and async threads
    648a18589c4 proxy: Name threads spawned by the event loop
    49834b2609e ci: add -Wextra-semi to default config
    fae9a637e35 example: Remove unused kj/async.h include
    bb473690c97 Fix error handling when creating clients
    44d191420c6 Add test coverage for ConnectStream
    231361ae5af Correct stale UnixListener doc comment
    060c1a50d03 Extract `UnixListener` class to a dedicated file
    62f25af06c3 test: check ReadList return value
    ce51d737255 ci: Set CMAKE_BUILD_PARALLEL_LEVEL to enable parallism in build jobs by default
    67302cd132a Merge bitcoin-core/libmultiprocess#331: Remove code for Cap'n Proto versions before 0.9
    f13c64ab54e Merge bitcoin-core/libmultiprocess#330: ci: Compile with minimum supported g++ in olddeps
    8e026f66252 Merge bitcoin-core/libmultiprocess#327: build: avoid unnecessary capnp-rpc dependency for mpgen
    e5206e9eb5b Merge bitcoin-core/libmultiprocess#325: cmake: Remove `QUIET` option from `find_package(CapnProto ...)`
    879efea2bc7 Merge bitcoin-core/libmultiprocess#321: ci: Roll NetBSD releases to 11.0, drop 9.4
    abf127a3141 Merge bitcoin-core/libmultiprocess#317: ipc: Fix mpgen capnp tool path for vcpkg/Windows builds
    c437d7f107e Merge bitcoin-core/libmultiprocess#310: test: cover immediate client disconnects for `ListenConnections`
    31bff8a673f Merge bitcoin-core/libmultiprocess#307: refactor: memcpy -> std::ranges::copy
    f355108b0a0 Merge bitcoin-core/libmultiprocess#303: type-chrono: Add CustomBuildField/CustomReadField overloads for std::chrono::time_point
    2d678177c14 Merge bitcoin-core/libmultiprocess#296: ci: Bump channel to nixos-26.05
    3f05b11624c util: kill and reap child on SpawnProcess error
    4a56c1837a7 util: report back child error to parent and throw
    a9e70dbe775 ci: Add NetBSD release 11.0
    2d33b14fb0e ci: Switch to default compiler on NetBSD 9.4
    36f74002775 ci: Drop NetBSD release 9.4
    bd508311b56 refactor: Drop stray semicolons after function definitions
    788f17a8509 Remove code for Cap'n Proto versions before 0.9
    7402affd0ce ci: Pin oldeps config to older nixpkgs channel to compile older cmake with older gcc
    edf63435624 ci: Compile with minimum supported g++-11 in olddeps
    fa47449afe1 cmake: avoid unnecessary capnp-rpc dependency for mpgen
    a494b764de5 cmake: Remove `QUIET` option from `find_package(CapnProto ...)`
    26452e02d75 refactor: memcpy -> std::ranges::copy
    e1dcc6eb182 Merge bitcoin-core/libmultiprocess#316: cmake: Fix stale codegen when mpgen binary changes
    7a72df02e2d type-chrono: Add CustomBuildField/CustomReadField overloads for std::chrono::time_point
    45b685c3f58 type-number, type-chrono: Fix static assert signed/unsigned comparisons
    45f6255975d type-number: exclude bool from the integral overload
    8d6d4649482 Merge bitcoin-core/libmultiprocess#315: Fix startup race in example
    a6fc80d2547 Merge bitcoin-core/libmultiprocess#311: bugfix: clear FD_CLOEXEC in child instead of parent before fork
    496fb84e69f test: cover immediate client disconnects for `ListenConnections`
    36c6c63520e doc: Document reference-counted EventLoop lifetime
    3a997e113cf Fix startup race in mpexample
    f5c15ce33ff Merge bitcoin-core/libmultiprocess#323: refactor: access ThreadContext through CurrentThread(), ci: switch Bitcoin Core to master
    66298c737f4 ci: Switch back to Bitcoin Core's master branch
    86b48105018 refactor: access ThreadContext through CurrentThread()
    eea9c64f6e1 cmake: Fix stale codegen when mpgen binary changes
    a26a08496b8 cmake: Fix mpgen capnp tool path for vcpkg/Windows builds
    140d9ba6ff7 test: allow custom log handler in `ListenSetup`
    1e0c7ff9a51 util: Clear FD_CLOEXEC in child instead of parent before fork
    8550ee6a317 util, refactor: Add ChildFail helper for post-fork child errors
    17eab90b526 test: Fix typo in listen_tests.cpp
    ce865a9ba86 refactor: Directly use value in CustomBuildField
    3f221b5bfd7 Merge bitcoin-core/libmultiprocess#274: Add nonunix platform support
    1b0f6056062 doc: Remove trailing whitespace
    d8f8ca3119f ipc: Wrap mpgen main() in try-catch to print errors
    fbe5a14ad46 ci: Check out bitcoin/bitcoin PR #35084 instead of master
    39d3690d83d types: Replace SFINAE with requires clauses to avoid MSVC C2039 error
    ba68520203c proxy, refactor: Fix C4305 truncation warning in Accessor on MSVC
    1d81d47811e util, refactor: Fix PtrOrValue constructor for move-only types on MSVC
    b883fe1e527 proxy: Fix shutdownWrite() exception handling on macOS with dynamic libraries
    0012411ccc6 proxy: Call shutdownWrite() in Connection destructor
    38312ad1912 proxy, refactor: Change ConnectStream and ServeStream to accept stream objects
    e96d5d742ab proxy, refactor: Replace EventLoop wakeup fd integers with KJ stream objects
    db4f9a3d739 cmake: Bump minimum required Cap'n Proto version to 0.9
    652934fb793 util, refactor: Add SocketPair() and use it in SpawnProcess
    1c6ef7a26c0 util, refactor: Do not fork() and exec() separately
    1389cf3132f util, refactor: Add SpawnConnectInfo type alias and use it
    c7ca1f00b62 util, refactor: Add SocketId type alias and use it
    be46a35203c util, refactor: Add ProcessId type alias and use it
    91a78db7808 doc: Bump version 13 > 14
    fa2c56ec27f ci: Bump channel to nixos-26.05
    
    git-subtree-dir: src/ipc/libmultiprocess
    git-subtree-split: 263139f41ddc47ffc9e7303f056a731818276355
    1d44fc9b7a
  3. Merge commit '1d44fc9b7a7e983fe91c4b8c33dee409c7338bc5' into pr/subtree-15 fbf291b963
  4. build: suppress -Wc++23-lambda-attributes in warn_interface
    Lambda [[noreturn]] attributes before the parameter list are a C++23
    extension intentionally used in C++20 builds (needed for compatibility
    with -Wmissing-noreturn). Suppress the extension warning rather than
    removing the attributes or working around them.
    
    Uses the existing IF_CHECK_PASSED idiom so GCC, which silently ignores
    unknown -Wno-* flags, is unaffected.
    
    This change was written with Claude Sonnet 4.6.
    13cf5d60ad
  5. DrahtBot commented at 5:23 PM on November 3, 2026: contributor

    <!--e57a25ab6845829454e8d69fc972939a-->

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

    <!--006a51241073e994b41acfe9ec718e94-->

    External sites

    <!--021abf342d371248e50ceaed478a90ca-->

    Reviews

    See the guideline and AI policy for information on the review process. A summary of reviews will appear here.

    <!--5faf32d7da4f0f540f40219e4f7537a3-->

  6. in CMakeLists.txt:525 in 13cf5d60ad
     520 | +  )
     521 | +  # Older clang versions (e.g. clang-17) do not recognize -Wc++23-lambda-attributes
     522 | +  # but emit the same diagnostic under the broader -Wc++23-extensions flag instead.
     523 | +  try_append_cxx_flags("-Wc++23-extensions" TARGET warn_interface SKIP_LINK
     524 | +    IF_CHECK_PASSED "-Wno-c++23-extensions"
     525 | +  )
    


    maflcko commented at 5:46 PM on November 3, 2026:

    note to myself: Can be removed in https://github.com/bitcoin/bitcoin/pull/36036

  7. in CMakeLists.txt:470 in 13cf5d60ad
     465 | @@ -466,6 +466,8 @@ if(MSVC)
     466 |    try_append_cxx_flags("/wd4267" TARGET warn_interface SKIP_LINK)
     467 |    try_append_cxx_flags("/wd4715" TARGET warn_interface SKIP_LINK)
     468 |    try_append_cxx_flags("/wd4805" TARGET warn_interface SKIP_LINK)
     469 | +  # C5283: lambda [[noreturn]] attribute before parameter list requires /std:c++23preview.
     470 | +  try_append_cxx_flags("/wd5283" TARGET warn_interface SKIP_LINK)
    


    maflcko commented at 5:47 PM on November 3, 2026:

    could merge #31507 first and then rebase, to avoid a conflict and avoid having to add this line?

Linked (view graph)
#212 db.cpp:811: undefined reference to `fUseUPnP'#274 Fixed German translation#298 Lower transaction fee to allow micro-transactions#303 Demystify a few magic numbers.#304 Fix CPU Usage bug when using -nolisten and have no connections.#307 listreceivedbyaddress and getaddressesbyaccount return incorrect data#310 Updated Chinese Simp translation#311 Added Swedish translation#312 Remove unused variable#315 Consistent Bitcoin example address#316 DB_RUNRECOVERY: Fatal error#317 Validiating Block Versions and Hash_Types#321 wallet rescan doesn't work properly#323 Listtransactions bad transaction numbering#324 New RPC command - getrawtransaction#325 Build fails with gcc-4.6, glibc-2.13, boost-1.46.1#327 add GetTotalBlocksEstimate() function, move magic number to constant#330 Non-English Decimal Interpreted Incorrectly in util.cpp:ParseMoney#331 Update translations and remove obsolete translations.#332 Include missing Boost header#334 Bugfixes walletclass#338 renameable wallet.dat#339 official binary releases should be shipped with debugging symbols#340 bug introduced in 0.3.23, crash when no network interfaces up.#341 mlock() all private keys in memory#343 rpc server: send '403 Forbidden' to rejected clients#344 RPC - Massive amount of TIME_WAIT connections (Pool)#345 Polish translation#347 Fix segfault when creating new wallet#349 Fix OP_CHECKSIG bug with OP_PUSHDATA#350 CWallet: fix mapAddress book update#351 OS font size issues on GUI#352 Wallet Private Key Encryption (on CWallet)#356 Boost unit-testing framework.#357 Add OSX App bundle and correct build instructions to reflect reality.#358 Address Book related Fixes#359 wrong english wording "start bitcoin on window system startup"#360 Minor non-blocker updates to Crypto.#362 Fix connection failure debug output#363 Improvements to unit test setup#364 fix check for USE_UPNP in makefile.unix#366 IRC connection command line arguments#367 Add new DNSSeed dnsseed.bluematt.me.#370 backup button in client for wallet.dat#371 Updated Visual C++ Makefile#379 Do not use comma as thousands separator#380 Added a couple minor things to match newer build process.#381 Add minversion to wallet.#383 Fix synchronization of default key#386 Support Dynamic Quicklists in Ubuntu Unity#387 Encapsulate wallet.dat in a folder alone #10102 Multiprocess bitcoin#29409 ipc: Expose Chain interface to IPC clients#32387 ipc: add windows support#35084 ipc: Add nonunix platform support#35720 ipc: Update libmultiprocess subtree and drop fuzz test workaround#35911 Warn on and add missing [[noreturn]]#36167 [RFC] Enable `-Wunused`#36743 [RFC] build: build with -Wmissing-declarations/prototypes

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-11-03 22:51 UTC

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