Repository navigation
Closed
Description
π§ At least one of the CI tasks failed.
Task Alpine (musl): https://github.com/bitcoin/bitcoin/actions/runs/27157390674/job/80163685993
LLM reason (β¨ experimental): CI failed because CTest timed out running the mptest test (mptest β Timeout after ~2400s).
Originally posted by @DrahtBot in #35487 (comment)
Normally, the test finishes in less than a second, so this looks like a clear bug in the test itself. The logs were:
351/351 Test #3: mptest ............................................................***Timeout 2400.10 sec
[ TEST ] spawn_tests.cpp:46: SpawnProcess does not run callback in child
[ PASS ] spawn_tests.cpp:46: SpawnProcess does not run callback in child (67572 ΞΌs)
[ TEST ] test.cpp:130: Call FooInterface methods
[ PASS ] test.cpp:130: Call FooInterface methods (10731 ΞΌs)
[ TEST ] test.cpp:231: Call IPC method after client connection is closed
[ PASS ] test.cpp:231: Call IPC method after client connection is closed (4165 ΞΌs)
[ TEST ] test.cpp:248: Calling IPC method after server connection is closed
[ PASS ] test.cpp:248: Calling IPC method after server connection is closed (535 ΞΌs)
[ TEST ] test.cpp:265: Calling IPC method and disconnecting during the call
[ PASS ] test.cpp:265: Calling IPC method and disconnecting during the call (531 ΞΌs)
[ TEST ] test.cpp:285: Calling IPC method, disconnecting and blocking during the call
[ PASS ] test.cpp:285: Calling IPC method, disconnecting and blocking during the call (915 ΞΌs)
[ TEST ] test.cpp:334: Worker thread destroyed before it is initialized
[ PASS ] test.cpp:334: Worker thread destroyed before it is initialized (10824 ΞΌs)
[ TEST ] test.cpp:371: Calling async IPC method, with server disconnect racing the call
[ PASS ] test.cpp:371: Calling async IPC method, with server disconnect racing the call (11922 ΞΌs)
[ TEST ] test.cpp:401: Calling async IPC method, with server disconnect after cleanup
[ PASS ] test.cpp:401: Calling async IPC method, with server disconnect after cleanup (826 ΞΌs)
[ TEST ] test.cpp:430: Make simultaneous IPC calls on single remote thread
Errors while running CTest
99% tests passed, 1 tests failed out of 351
Activity
maflcko commentedon Jun 9, 2026
ref: #34014 (comment)
fanquake commentedon Jun 9, 2026
cc @Sjors @ryanofsky
fanquake commentedon Jun 9, 2026
@dergoegge maybe you can reproduce in antithesis? (See prior discussion in #34014)
maflcko commentedon Jun 9, 2026
Or maybe in https://github.com/dergoegge/bedrock?
In the meantime I'll try to reproduce on a fresh
podman run -it --rm --platform=linux alpine:3.23:apk update && apk add rsync screen python3 git bash vim && git clone --depth=1 https://github.com/bitcoin/bitcoin ./b-c-ci && cd ./b-c-ciRUN_UNIT_TESTS=false RUN_FUNCTIONAL_TESTS=false CCACHE_DIR=/ccache_dir CCACHE_MAXSIZE=5500M USER=dummy_user DANGER_RUN_CI_ON_HOST="1" MAKEJOBS="-j$(nproc)" FILE_ENV="./ci/test/00_setup_env_native_alpine_musl.sh" ./ci/test_run_all.shwhile /ci_container_base/ci/scratch*/build-*/src/ipc/libmultiprocess/test/mptest ; do true ; donemaflcko commentedon Jun 9, 2026
bt is:
ryanofsky commentedon Jun 9, 2026
re: #35491 (comment)
Nice, thanks for reproducing and providing the stack trace. The hang on line 479 suggests this is probably a test bug:
bitcoin/src/ipc/libmultiprocess/test/mp/test/test.cpp
Line 479 in bcbf5ba
Reviewing test test more closely, I suspect following change would fix it:
This looks like a lost wakeup bug where
notify_allhas no effect because the notify happens when the thread callingwaitis not currently waiting (either because it hasn't started to wait yet, or because it stops waiting to checkrunning == 0).It looks like this bug has been present since this test was added in bitcoin-core/libmultiprocess@1238170, and probably happened because c++'s documentation around what locking is required for
notify_allis pretty confusing, as we've seen before ("I didn't know that c++ still requires the lock to be held before notifying, even though it now recommends against holding the lock while notifying").maflcko commentedon Jun 9, 2026
Seems fine, but I feel like clang thread safety annotations should be used to avoid this (and other problems in the future). At least this was the conclusion in https://mirror.b10c.me/bitcoin-bitcoin/30967#discussion_r1780728018. Also this is what isocpp/CppCoreGuidelines#1272 (comment) recommends?
ryanofsky commentedon Jun 9, 2026
Thanks, the lock and mutex class used here do use clang's thread safety annotations, and I don't see an obvious way more annotations could make a difference here, but it might be possible. I do agree with the conclusion in that thread that just taking the basic lock/update/notify approach and not trying to be clever with std::atomics and other optimizations is good.
The C++ guidelines also seem good. I think the notify_all documentation is just misleading when it says:
Because this implies that you don't need to lock a mutex to send a notification, when you actually do. C++ does make it ok (unlike posix threads) to unlock the mutex before sending the notification, but you still need to lock the mutex after the state transition to be sure the waiting thread is waiting.
maflcko commentedon Jun 10, 2026
Just like fad8e7f, the cv should be guarded:
This will catch the issue at compile-time:
Sent a pull to bitcoin-core/libmultiprocess#295
ryanofsky commentedon Jun 11, 2026
I see. It's an interesting idea to guard the condition variable with the mutex, and I didn't know you could do that. It's not a clear win because it leads to less than optimal code by preventing releasing the lock before notifying as notify_one recommends, potentially triggering the "hurry up and wait" scenario described there depending on the thread implementation.
It also looks like guarding the condition variable could have gone against CppCoreGuidelines according to the issue you linkedm but they decided not to add a guideline addressing this because performance is "not the main focus of the guidelines".
I'd agree though having this annotation is better than not having it in cases like these where performance is not important.
Merge #295: Mark Waiter m_cv as guarded by m_mutex
fanquake commentedon Jun 24, 2026
https://github.com/bitcoin/bitcoin/actions/runs/28115903808/job/83255173291
maflcko commentedon Jun 24, 2026
I think this just needs a subtree update?
maflcko commentedon Jun 27, 2026
https://github.com/bitcoin/bitcoin/actions/runs/28295724377/job/83835190188?pr=34927#step:10:2876 (arm32)
nkaretnikov commentedon Jul 2, 2026
I'm looking at this with Bedrock. Will post more information once I have it.
maflcko commentedon Jul 7, 2026
#35661 (comment)