This fixes an antithesis bug reported in #35845 and similar bug reported in #33387 where if asynchronous IPC mining calls are made when the node is shutting down it's possible for assert(m_node.chainman) to trigger. This happens because the Ipc::disconnectIncoming method does not wait for asynchronous calls to complete after it disconnects IPC clients, so they may continue to run as the node is shutting down.
This PR changes disconnectIncoming to wait for asynchronous calls to complete to avoid this issue. It's a draft because it depends on libmultiprocess changes, but should otherwise be ready to review.
This is based on bitcoin-core/libmultiprocess#361 and bitcoin-core/libmultiprocess#335, included through a src/ipc/libmultiprocess subtree update that also contains bitcoin-core/libmultiprocess#377, which this PR does not need.
<!-- begin based-on -->
The non-base commits are:
8a948e2bdd4doc: Improve disconnect callback comments59f703760b2doc: Improve Waiter/EventLoop lock order documentation98533b0201eproxy-io: fix listener stuck at capacity after a local disconnect0b1730bad11proxy-io: fix race deleting a disconnected Connection twice789775cb46cproxy: Fix thread map teardown race causing use-after-free on disconnect580d9644a71proxy-io: add Connection::disconnect() separating teardown from destructionbb588048d12proxy-io: add Connection::waitDrained() to wait for in-flight server calls0ad96a7fab3test: cover draining in-flight server call after disconnectd9ffa655294ipc: use ServeStream/ConnectStream in Bitcoin Core IPC codedc293af2f43ipc: drain in-flight server calls before shutdown frees node state01a01e35d97lint: Skip subtree check for src/ipc/libmultiprocess<!-- end -->
Status (2026-11-13)
This is a draft with no reviews yet. It waits on bitcoin-core/libmultiprocess#361 and bitcoin-core/libmultiprocess#335, both open, and on a subtree update that includes them. Neither has had new reviews since 2026-11-04; bitcoin-core/libmultiprocess#335 still has open review comments from before.
- Remaining work:
- Check whether the node may hang at exit when an IPC client is connected at shutdown, since the disconnected connections no longer appear to be destroyed (suspected from the code, not yet reproduced).
- Add a test that stops the node with a call in progress, and update the code comment and commit message, which describe an earlier version of the change (the comment still says the connections are destroyed and names
mp::Connection::waitDrained).