Originally posted by @darosior in https://github.com/bitcoin/bitcoin/issues/10102#issuecomment-2515554249
Not sure if it’s worth sharing here but hey what’s an 1300th comment.
Running bitcoin-node from https://github.com/bitcoin/bitcoin/pull/29409 with commits 1045047a73a0b3ae15647ab5bf1829d27141b7cd..9ca113f326fc9ba2f661595283f4aef390df984d from this PR cherry-picked on top.
Simply compiled with cmake -B multiprocbuild/ -DWITH_MULTIPROCESS=ON && cmake --build multiprocbuild/ -j20. (Although i did have to apply the following diff to be able to compile on Debian stable.)
0diff --git a/CMakeLists.txt b/CMakeLists.txt
1index 6ae988ac90..ca0880b3cd 100644
2--- a/CMakeLists.txt
3+++ b/CMakeLists.txt
4@@ -23,6 +23,7 @@ set(CLIENT_VERSION_BUILD 0)
5 set(CLIENT_VERSION_RC 0)
6 set(CLIENT_VERSION_IS_RELEASE "false")
7 set(COPYRIGHT_YEAR "2024")
8+set(FOUND_LIBATOMIC TRUE)
9
10 # During the enabling of the CXX and CXXOBJ languages, we modify
11 # CMake's compiler/linker invocation strings by appending the content
12diff --git a/src/test/ipc_test.cpp b/src/test/ipc_test.cpp
13index 91eba9214f..af37434980 100644
14--- a/src/test/ipc_test.cpp
15+++ b/src/test/ipc_test.cpp
16@@ -62,7 +62,7 @@ void IpcPipeTest()
17
18 auto connection_client = std::make_unique<mp::Connection>(loop, kj::mv(pipe.ends[0]));
19 auto foo_client = std::make_unique<mp::ProxyClient<gen::FooInterface>>(
20- connection_client->m_rpc_system.bootstrap(mp::ServerVatId().vat_id).castAs<gen::FooInterface>(),
21+ connection_client->m_rpc_system->bootstrap(mp::ServerVatId().vat_id).castAs<gen::FooInterface>(),
22 connection_client.get(), /* destroy_connection= */ false);
23 foo_promise.set_value(std::move(foo_client));
24 disconnect_client = [&] { loop.sync([&] { connection_client.reset(); }); };
Just starting bitcoin-node and stopping it with a SIGKILL results in the following crash:
02024-12-03T20:49:29Z [ipc] {bitcoin-node-69380/bitcoin-node-69380} IPC client exception kj::Exception: kj/async-io-unix.c++:323: disconnected: ::read(fd, buffer, maxBytes): Connection reset by peer
1stack: 7f53be1b41d4 7f53be1bf95b 7f53be15a911 7f53be1ab560 7f53be3147f0 7f53be30e0a0 7f53be3120f0 7f53be370bf0 7f53be36b6d0 7f53be361de0 7f53be35bea0 7f53be34e160 7f53be34ebc4 7f53be34b7a0 562975c42300 562975c4c8c0
22024-12-03T20:49:29Z [ipc] kj::Exception: kj/async-io-unix.c++:323: disconnected: ::read(fd, buffer, maxBytes): Connection reset by peer
3stack: 7f53be1b41d4 7f53be1bf95b 7f53be15a911 7f53be1ab560 7f53be3147f0 7f53be30e0a0 7f53be3120f0 7f53be370bf0 7f53be36b6d0 7f53be361de0 7f53be35bea0 7f53be34e160 7f53be34ebc4 7f53be34b7a0 562975c42300 562975c4c8c0
42024-12-03T20:49:29Z [ipc] {bitcoin-node-69380/b-capnp-loop-69383} IPC client: unexpected network disconnect.
5terminate called after throwing an instance of 'ipc::Exception'
6 what(): kj::Exception: kj/async-io-unix.c++:323: disconnected: ::read(fd, buffer, maxBytes): Connection reset by peer
7stack: 7f53be1b41d4 7f53be1bf95b 7f53be15a911 7f53be1ab560 7f53be3147f0 7f53be30e0a0 7f53be3120f0 7f53be370bf0 7f53be36b6d0 7f53be361de0 7f53be35bea0 7f53be34e160 7f53be34ebc4 7f53be34b7a0 562975c42300 562975c4c8c0
8Aborted
The command i used to start it is ./multiprocbuild/src/bitcoin-node -regtest -ipcbind=unix -debug=ipc.
With a simple hacked up client which constructs an Init interface and stops, the crash becomes (still only when stopping bitcoin-node):
0terminate called after throwing an instance of 'std::logic_error'
1 what(): clientInvoke call made after disconnect
2Aborted
Now if the client requested a thread before stopping, this becomes a segfault (still only when stopping bitcoin-node):
02024-12-03T21:02:50Z [ipc] {bitcoin-node-70275/bitcoin-node-70275} IPC client exception kj::Exception: kj/async-io-unix.c++:532: disconnected: ::writev(fd, iov.begin(), iov.size()): Broken pipe; iovTotal = 176; iov.size() = 2
1stack: 7f70b535079f 7f70b5350cad 7f70b54a9544 7f70b54a9732 7f70b54a978a 7f70b550825d 7f70b5507180 7f70b55016d0 7f70b54f7de0 7f70b54f1ea0 7f70b54e4160 7f70b54e4bc4 7f70b54e17a0 56041e62f300 56041e6398c0
22024-12-03T21:02:50Z [ipc] {bitcoin-node-70275/b-capnp-loop-70278} IPC client: unexpected network disconnect.
3Segmentation fault