Repository navigation
Closed
Description
There seems to be an unhandled exception when deserializing an invalid coinbase in submitSolution.
log
node0 2025-09-08T11:26:56.165687Z [capnp-loop] [../../../src/ipc/capnp/protocol.cpp:35] [void ipc::capnp::(anonymous namespace)::IpcLogFn(bool, std::string)] [ipc] {bitcoin-node-166995/b-capnp-loop-166997} IPC server recv request #14 BlockTemplate.submitSolution$Params (context = (thread = <external capability>), version = 0, timestamp = 0, nonce = 0, coinbase = "")
node0 2025-09-08T11:26:56.165711Z [capnp-loop] [../../../src/ipc/capnp/protocol.cpp:35] [void ipc::capnp::(anonymous namespace)::IpcLogFn(bool, std::string)] [ipc] {bitcoin-node-166995/b-capnp-loop-166997} IPC server post request #14 {bitcoin-node-166995/b-capnp-loop-167036 (from pythread)}
test 2025-09-08T11:26:56.207859Z TestFramework (ERROR): Unexpected exception
Traceback (most recent call last):
File "/root/bitcoin/test/functional/test_framework/test_framework.py", line 199, in main
self.run_test()
File "/root/bitcoin/./debugbuild/test/functional/interface_ipc.py", line 186, in run_test
self.run_mining_test()
File "/root/bitcoin/./debugbuild/test/functional/interface_ipc.py", line 182, in run_mining_test
asyncio.run(capnp.run(async_routine()))
File "/usr/lib/python3.11/asyncio/runners.py", line 190, in run
return runner.run(main)
^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/asyncio/runners.py", line 118, in run
return self._loop.run_until_complete(task)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/asyncio/base_events.py", line 653, in run_until_complete
return future.result()
^^^^^^^^^^^^^^^
File "capnp/lib/capnp.pyx", line 1965, in run
File "capnp/lib/capnp.pyx", line 1966, in capnp.lib.capnp.run
File "/root/bitcoin/./debugbuild/test/functional/interface_ipc.py", line 128, in async_routine
result = await template.result.submitSolution(ctx, 0, 0, 0, b"")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
capnp.lib.capnp.KjException: capnp/rpc.c++:2778: disconnected: Peer disconnected.
stack: 7fd1cba914c4 7fd1cba87d10 7fd1cba777c0 7fd1cb9164f0 7fd1cb9187d0
test 2025-09-08T11:26:56.218026Z TestFramework (DEBUG): Closing down network thread
test 2025-09-08T11:26:56.268255Z TestFramework (INFO): Not stopping nodes as test failed. The dangling processes will be cleaned up later.
test 2025-09-08T11:26:56.268354Z TestFramework (WARNING): Not cleaning up dir /tmp/bitcoin_func_test_jp4hfh13
test 2025-09-08T11:26:56.268384Z TestFramework (ERROR): Test failed. Test logging available at /tmp/bitcoin_func_test_jp4hfh13/test_framework.log
test 2025-09-08T11:26:56.268453Z TestFramework (ERROR):
test 2025-09-08T11:26:56.268517Z TestFramework (ERROR): Hint: Call /root/bitcoin/test/functional/combine_logs.py '/tmp/bitcoin_func_test_jp4hfh13' to consolidate all logs
test 2025-09-08T11:26:56.268547Z TestFramework (ERROR):
test 2025-09-08T11:26:56.268569Z TestFramework (ERROR): If this failure happened unexpectedly or intermittently, please file a bug and provide a link or upload of the combined log.
test 2025-09-08T11:26:56.268603Z TestFramework (ERROR): https://github.com/bitcoin/bitcoin/issues
test 2025-09-08T11:26:56.268627Z TestFramework (ERROR):
node0 stderr terminate called after throwing an instance of 'std::ios_base::failure[abi:cxx11]'
what(): SpanReader::read(): end of data: iostream error I found this while using fuzzamoto to test the mining interface, but the easiest way to reproduce would be to just add
await template.result.submitSolution(ctx, 0, 0, 0, b"")after creating the block template in the IPC functional test (interface_ipc.py).
Reacted by Niklas Gögge, Reproducibility Matters, Bruno Garcia and Enoch Azariah
Reacted by Sjors Provoost and Eugene
Activity
fanquake commentedon Sep 8, 2025
@Sjors @ryanofsky
Sjors commentedon Sep 8, 2025
Thanks, I was able to reproduce that. Will add a guard and test.
Sjors commentedon Sep 8, 2025
@ryanofsky looks like libmultiprocess needs to catch this earlier, because even if I make
bool submitSolutionimmediately returnfalseit crashes.The node crashes with:
ryanofsky commentedon Sep 8, 2025
Nice find. This behavior is expected but should be improved, and shouldn't be hard to improve.
It's similar to bitcoin-core/libmultiprocess#206 in that if a bad request is sent to the node, the node will crash instead of returning an error, when it could just as easily return an error, and it would make sense to do that for the sake of stability and to make development easier with other languages like rust and python.
Similar to bitcoin-core/libmultiprocess#206 this type of error is difficult to trigger from c++ unless you call the function with an argument that can only be serialized but not deserialized.
It should not be hard to add some code to serverInvoke to catch and log uncaught exceptions and reject the request. I can follow up with a PR to address this and bitcoin-core/libmultiprocess#206
marcofleon commentedon Feb 27, 2026
cc @Sjors
ryanofsky commentedon Feb 27, 2026
The uncaught exceptions should now be caught with bitcoin-core/libmultiprocess@c4762c7 in bitcoin-core/libmultiprocess#240 and #34422. So this issue should be resolved #34422 although it might be good to add a test to check the error message that's returned.
ryanofsky commentedon Feb 27, 2026
Confirmed following test passes locally with #34422
I think this would be good to add as a followup to #34422, maybe bundled with other followups already discussed
#34422 (comment). The test might also need to be adjusted to work on different CI jobs
Sjors commentedon Mar 13, 2026
#34727 adds test coverage for this
test: verify IPC error handling for invalid coinbase
hodlinator commentedon Mar 23, 2026
Correction: #34727
Merge bitcoin#34727: test: Add IPC wake-up test and reuse mining context
test: verify IPC error handling for invalid coinbase
ryanofsky commentedon Apr 8, 2026
#34644 (comment) reports a similar issue probably caused by the same bug
test: verify IPC error handling for invalid coinbase