IPC server abort when returning interface as connection broken #226

issue ryanofsky openend this issue on October 8, 2025
  1. ryanofsky commented at 0:23 am on October 8, 2025: collaborator

    The MakeProxyServer function is not checking if the connection has been broken before trying to create a new ProxyServer object referencing the Connection object.

    This seems to cause a bitcoin-node crash reported by plebhash in https://github.com/bitcoin/bitcoin/issues/33554#issuecomment-3378637474, where a custom RPC client makes a Mining.waitNext call, and then exits, breaking the connection before the waitNext call finishes executing. When the waitNext call does later finish and return, the MakeProxyServer function is called to make a ProxyServer<BlockTemplate> object to return to the client. But construction of this object aborts while accessing the Connection object which was already deleted.

    It would be good to write a libmultiprocess unit test triggering this problem, and then implement a fix to prevent it from happening.

    I think in order to fix this, the InvokeContext struct could be changed to contain Connection* pointer instead of a Connection& reference. Then, the MakeProxyServer function could return null if the connection is null. The mp.Context PassField function could use the Connection::addSyncCleanup method to actually set the connection pointer to null when the connection is closed. The InvokeContext struct might also need to have an optional Waiter pointer added for synchronization since addSyncCleanup cleanups run on the event loop thread but MakeProxyServer method runs on the waitNext worker thread.


ryanofsky


github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin-core/libmultiprocess. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2025-12-04 19:30 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me