chia-blockchain: [Bug] uncaught KeyError exception in block_record
What happened?
I am not sure if this would be possible to reproduce, but I was running chia on raspberry (4GB RAM) for a like half a year, when in October the entire FS crashed, and I had to reinstall and unfortunately sync from scratch. After like 2 months of checking and regular restarts of chia daemon it got into near sync state of blockchain (wallet was full sync, but chain last day missing, this was somewhere between 21-22nd December). But when I’ve checked it after Christmas, the log is full of this:
2021-12-27T13:59:13.294 full_node full_node_server : WARNING Banning 99.152.32.71 for 10 seconds
2021-12-27T13:59:13.296 full_node chia.full_node.full_node: INFO peer disconnected {'host': '99.152.32.71', 'port': 8444}
2021-12-27T13:59:13.298 full_node full_node_server : ERROR Exception b'\xd7\x80\xd2,z\x87\xc9\xe0\x1d\x98\xb4\x9a\t\x10\xf6p\x1c;\x95\x01WA1k?\xda\x04.]{\x81\xd2', exception Stack: Traceback (most recent call last):
File "chia/server/server.py", line 437, in start_client
File "chia/server/server.py", line 335, in connection_added
File "chia/full_node/full_node.py", line 619, in on_connect
File "chia/full_node/full_node.py", line 585, in synced
File "chia/consensus/blockchain.py", line 157, in get_peak
File "chia/consensus/blockchain.py", line 674, in height_to_block_record
File "chia/consensus/blockchain.py", line 670, in block_record
KeyError: b'\xd7\x80\xd2,z\x87\xc9\xe0\x1d\x98\xb4\x9a\t\x10\xf6p\x1c;\x95\x01WA1k?\xda\x04.]{\x81\xd2'
2021-12-27T13:59:13.301 full_node asyncio : ERROR Task exception was never retrieved
future: <Task finished name='Task-291378' coro=<RpcServer._state_changed() done, defined at chia/rpc/rpc_server.py:48> exception=KeyError(b'\xd7\x80\xd2,z\x87\xc9\xe0\x1d\x98\xb4\x9a\t\x10\xf6p\x1c;\x95\x01WA1k?\xda\x04.]{\x81\xd2')>
Traceback (most recent call last):
File "chia/rpc/rpc_server.py", line 51, in _state_changed
File "chia/rpc/full_node_rpc_api.py", line 61, in _state_changed
File "chia/rpc/full_node_rpc_api.py", line 102, in get_blockchain_state
File "chia/consensus/blockchain.py", line 157, in get_peak
File "chia/consensus/blockchain.py", line 674, in height_to_block_record
File "chia/consensus/blockchain.py", line 670, in block_record
KeyError: b'\xd7\x80\xd2,z\x87\xc9\xe0\x1d\x98\xb4\x9a\t\x10\xf6p\x1c;\x95\x01WA1k?\xda\x04.]{\x81\xd2'
2021-12-27T13:59:14.603 full_node full_node_server : INFO Cannot connect to host 112.25.210.130:8444 ssl:<ssl.SSLContext object at 0xffff377097c0> [Connect call failed ('112.25.210.130', 8444)]
running eg. chia show -s results in similar message:
Exception from 'show' Traceback (most recent call last):
File "chia/cmds/show.py", line 41, in show_async
File "chia/rpc/full_node_rpc_client.py", line 27, in get_blockchain_state
File "chia/rpc/rpc_client.py", line 49, in fetch
ValueError: {'error': "b'\\xd7\\x80\\xd2,z\\x87\\xc9\\xe0\\x1d\\x98\\xb4\\x9a\\t\\x10\\xf6p\\x1c;\\x95\\x01WA1k?\\xda\\x04.]{\\x81\\xd2'", 'success': False}
but chia wallet show is ok, so seems only main daemon is somehow stuck:
chia wallet show
Wallet height: 1338206
Sync status: Synced
...
Version
1.2.11
What platform are you using?
Pi4
What ui mode are you using?
CLI
Relevant log output
No response
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 5
- Comments: 88 (28 by maintainers)
I’ve just checked my node, and you are right, the block 0 is actually set as peak:
So I’ve tried swapping peak on block 0 vs last block as suggested:
and yes, it solves the problem, chia is again syncing. Question still remains how this could happen? Some remote trigger? ( / attacker?) Client bug? Protocol bug?
We will shortly release 1.3 beta which fixes this issue.
Please see my message above. The current fix is: