mirror of
https://github.com/bitcoin/bitcoin
synced 2026-12-04 12:20:38 +00:00
depends: fix non-atomic reads in capnp debug assertions #36556
No reviewers
Labels
No labels
Android
Backport
Block storage
Brainstorming
Bug
Build system
CI failed
Consensus
Data corruption
Descriptors
Docs
DrahtBot Guix build requested
Feature
Fuzzing
GUI
Good First Review
IPC
Insufficient Review
Kernel
Linux/Unix
Mempool
Mining
Needs Backport (31.x)
Needs Backport (32.x)
Needs Benchmark
Needs Conceptual Review
Needs backport (30.x)
Needs rebase
Needs release note
Net
P2P
PSBT
Privacy
Private Broadcast
Questions and Help
RPC/REST/ZMQ
Refactoring
Resource usage
Review club
Scripts and tools
Settings
TX fees and policy
Tests
Tracking Issue
UTXO Db and Indexes
Up for grabs
Upstream
Utils/log/libs
Validation
Waiting for author
Wallet
Windows
good first issue
interfaces
macOS
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
bitcoin/bitcoin!36556
Loading…
Reference in a new issue
No description provided.
Delete branch "depends-capnp-kj-atomic-reads"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
KJ's debug assertions read the mutex futex word and
AtomicRefcountedrefcounts non-atomically. The TSan job builds capnp without optimization, which automatically enables these assertions, and TSan reports these reads as data races the moment KJ objects start communicating across threads.libmultiprocess enables cross-thread communication for the first time in bitcoin-core/libmultiprocess#376, which replaces the pipe used in
EventLoop::sync()withkj::Executor::executeSync(). This is what triggered the failure.Patches are the upstream commits capnproto/capnproto@b91a6ba7c7 and capnproto/capnproto@cc13c8c45f, which are backports of the v2 fixes in capnproto/capnproto#2781 and capnproto/capnproto#2843 (backport PR: capnproto/capnproto#2855).
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.
External sites
Reviews
See the guideline and AI policy for information on the review process.
If your review is incorrectly listed, please copy-paste
<!--meta-tag:bot-skip-->into the comment that the bot should ignore.Base:
7efbdb6437a840217127bd7dea0b963c67613860Head:
6e8e85ddcf2eb4a062fab3cd2b9c046edfbf72ecNo verified findings are available from this review.
Review coverage was incomplete.
Review limitations
+=appended entries and the resulting build-id/caching behavior were assumed valid from base convention.a/c++/src/kj/...prefix depth could not be compared against the existing-p2convention; a depth mismatch would make the newpatch -p2invocations fail.Full review report
cc @Sjors @ryanofsky
ACK
6e8e85ddcfI verified that the patches match upstream, and that TSan needs both (if we continue with https://github.com/bitcoin-core/libmultiprocess/pull/376).
If we want capnp's tests to pass under TSan, we'd have to backport several other changes. But given that we set
BUILD_TESTING=OFF, I guess it's unnecessary to backport things just to make tests pass? (I did manage locally)Thanks @Sjors! I'm not sure which exact tests would fail and need backports, but I'd lean toward keeping
BUILD_TESTING=OFFas you said, so we don't unnecessarily backport things just to make them work.Code review ACK
6e8e85ddcf. Thanks for tracking down the race and getting the fix merged upstream first, which makes the patches easy to check.I checked that both patch files are identical to
git format-patchoutput for capnproto/capnproto@b91a6ba7c7 and capnproto/capnproto@cc13c8c45f apart from the git version in the signature line, that these are the two commits capnproto/capnproto#2855 mergedIn commit "depends: fix non-atomic reads in capnp debug assertions" (
6e8e85ddcf)Note: these two patches can be dropped when depends moves to a capnp release that includes capnproto/capnproto#2855, which was merged into capnproto master after v1.5.0.
re: Sjors https://github.com/bitcoin/bitcoin/pull/36556#issuecomment-6311264354
In commit "depends: fix non-atomic reads in capnp debug assertions" (
6e8e85ddcf)Yeah, backporting test-only fixes could add more patches to maintain, so I think current approach is reasonable, though theoretically enabling more test could expose issues worth fixing.
Guix Build:
Guix builds (on x86_64) [untrusted test-only build, possibly unsafe, not for production use]
229e79321c(master)
40bb0da742(pull/36556/merge)
3ec4f28bbd242e06...8df6c3c9f568e26d...65759403cebedf03...fd4a78afbeab18fb...7ad9cdc35373432c...49afec523c4cfe67...ca61cbb18adaaf11...1624c9fcbfad32e2...9740298c9f5d42ea...1c29eeff7353e093...353c3ebcef2ac475...771239ff12556e0c...146f0ec490a2b9c3...a716bc2b4a9e576a...104896964fee3b82...35688848a4bffd37...73db37793a77b763...20e64076916a8f20...4d627f66b4ced378...6b91d9a201ae3641...037ebba78e3e04b2...6f2175d29928ec7c...56a941b52f2b7e23...28031b4d92fb8483...d71f8a2291303a4b...efac3adf10ea6b65...e8704bdf4214e347...6df92eefa45d3c2d...c92856aaae10aaee...a5afb4ea657c2478...8c57a8b8094e5025...b2972d7e39a4f401...03c5e3ea843dba0f...7c23d7d5b661175c...96458bce03f6cde8...8fc4bc86158fdd89...c181d39d826b32f5...83488a8a0e959732...9913f8c9f4d30c73...5c49efcbb2ea5115...1466bdd87f5d7a50...5b4350f914688ae5...cf268cb2fb27a9ce...19ad0abb3281e3bb...9e55024fcd2b3b46...458ca79337b41bc3...f71f894b59a805fa...