You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
IPC server abort when returning interface as connection broken #226
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 bitcoin/bitcoin#33554 (comment), 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.
I don't have much context about multiprocess work so I'm not 100% sure if this new crash is related to the same root cause. Curious about what you think
I think this is the first time we've seen this bug happen outside of tests and antithesis runs so it is useful to have confirmation it can happen with a real client. I'd be curious to know if you saw this bug happening reliably or if it required repeated tries to reproduce since previously I thought the bug would be pretty unlikely to happen without unusual timing.
Also this bug isn't exactly the same as the original bug reported in this issue. The original bug reported here didn't depend on thread time timing and was fixed by 0174450 from #240 and bitcoin/bitcoin#34422
I think this is the first time we've seen this bug happen outside of tests and antithesis runs so it is useful to have confirmation it can happen with a real client. I'd be curious to know if you saw this bug happening reliably or if it required repeated tries to reproduce since previously I thought the bug would be pretty unlikely to happen without unusual timing.
It was happening like around 1/3 or 1/2 of the times I tested it, I did test even at 2025-10-07-abort-proxy-io branch from sv2-bitcoin-core but it never broke there, not sure what exactly the difference is between both branches.
Just pulled the fixes in master and tested again, it's definitely better now! The client doesn't crash even after a few hours and tries.
Activity
xyzconstant commentedon Mar 28, 2026
Hi!
I was trying to reproduce this issue as plebhash indicated but with a few tweaks:
sv2-bitcoin-core's .capnp schemas provider rev to 2140-dev/bitcoin-capnp-types@83d487bsv2-bitcoin-corecode to fix import issues (caused by the .capnp schemas changes) and "invalid thread handle" errorsIt still crashes but with a different stacktrace instead:
I don't have much context about multiprocess work so I'm not 100% sure if this new crash is related to the same root cause. Curious about what you think
ryanofsky commentedon Mar 30, 2026
re: #226 (comment)
Thanks for the report!
This looks like the same crash reported bitcoin/bitcoin#34777 and fixed in f5509a3 from #249 and bitcoin/bitcoin#34804 and bitcoin/bitcoin#34952
I think this is the first time we've seen this bug happen outside of tests and antithesis runs so it is useful to have confirmation it can happen with a real client. I'd be curious to know if you saw this bug happening reliably or if it required repeated tries to reproduce since previously I thought the bug would be pretty unlikely to happen without unusual timing.
Also this bug isn't exactly the same as the original bug reported in this issue. The original bug reported here didn't depend on thread time timing and was fixed by 0174450 from #240 and bitcoin/bitcoin#34422
ryanofsky commentedon Mar 30, 2026
Will close this given the fix for the original issue in #240, but feel free to follow up here or open new issues, and thanks for testing this!
xyzconstant commentedon Mar 30, 2026
Thanks for the context and links to the fixes!
It was happening like around 1/3 or 1/2 of the times I tested it, I did test even at
2025-10-07-abort-proxy-iobranch fromsv2-bitcoin-corebut it never broke there, not sure what exactly the difference is between both branches.Just pulled the fixes in master and tested again, it's definitely better now! The client doesn't crash even after a few hours and tries.