Related: #36585.
Depends on bitcoin-core/libmultiprocess#403 (fixes bitcoin-core/libmultiprocess#385).
Note: The first commit (
[DO NOT MERGE]) temporarily mirrors thelibmultiprocessPR insrc/ipc/libmultiprocess/include/mp/proxy-io.hso CI can build and test this branch. It will be dropped oncelibmultiprocessmerges and is subtree-synced.
Motivation
During Shutdown(), disconnectIncoming() closes existing IPC connections but leaves the listening socket open and present on disk. Auto-reconnecting IPC clients (such as mining clients like sv2-tp or ckpool) can reconnect in this window, acquiring a new EventLoopRef and causing ~CapnpProtocol() to hang indefinitely waiting for the reconnected client (#36585).
Change
src/ipc/capnp/protocol.cpp: Store the std::shared_ptr<mp::Listener> handles returned by mp::ListenConnections() in CapnpProtocol::m_listeners, and stop/clear them on m_loop->sync at the start of disconnectIncoming() (before removing existing m_incoming_connections) and in ~CapnpProtocol().