Chia-Network / chia-blockchain

Chia blockchain python implementation (full node, farmer, harvester, timelord, and wallet)
Apache License 2.0
10.82k stars 2.03k forks source link

[Bug] full node keeps looping and cannot be started #17337

Closed Sakuya-CN closed 8 months ago

Sakuya-CN commented 9 months ago

What happened?

When I changed from version below 2.0 to version above 2.0, I was prompted that the database needed to be upgraded to V2, but my upgrade failed, causing the block data to be damaged. I tried to download the torrent snapshot and restart the gui program of version 2.1.4. Always stuck in full node, it seems that block snapshot cannot be used

Version

2.1.4

What platform are you using?

Windows

What ui mode are you using?

GUI

Relevant log output

==============cli start full_node error================
C:\Program Files\Chia\resources\app.asar.unpacked\daemon>start_full_node.exe
Traceback (most recent call last):
  File "chia\server\start_full_node.py", line 104, in <module>
  File "chia\server\start_full_node.py", line 100, in main
  File "chia\server\start_service.py", line 321, in async_run
  File "asyncio\runners.py", line 44, in run
  File "asyncio\base_events.py", line 649, in run_until_complete
  File "chia\server\start_full_node.py", line 83, in async_main
  File "chia\server\start_service.py", line 195, in run
  File "contextlib.py", line 199, in __aenter__
  File "chia\server\start_service.py", line 212, in manage
  File "contextlib.py", line 619, in enter_async_context
  File "contextlib.py", line 199, in __aenter__
  File "chia\full_node\full_node.py", line 268, in manage
  File "chia\consensus\blockchain.py", line 160, in create
  File "chia\consensus\blockchain.py", line 172, in _load_chain_from_store
  File "chia\full_node\block_height_map.py", line 78, in create
  File "aiosqlite\context.py", line 39, in __aenter__
  File "aiosqlite\core.py", line 190, in execute
  File "aiosqlite\core.py", line 133, in _execute
  File "aiosqlite\core.py", line 106, in run
sqlite3.DatabaseError: database disk image is malformed
[6660] Failed to execute script 'start_full_node' due to unhandled exception!
===================================================================================
=============================== start log =========================================

2024-01-16T17:27:19.746 farmer chia.server.start_service  : ERROR    fatal uncaught exception: AttributeError: 'int' object has no attribute 'name'
Traceback (most recent call last):
  File "chia\util\log_exceptions.py", line 20, in log_exceptions
  File "chia\server\start_service.py", line 321, in async_run
  File "asyncio\runners.py", line 44, in run
  File "asyncio\base_events.py", line 636, in run_until_complete
  File "asyncio\windows_events.py", line 321, in run_forever
  File "asyncio\base_events.py", line 603, in run_forever
  File "asyncio\base_events.py", line 1871, in _run_once
  File "asyncio\windows_events.py", line 444, in select
  File "asyncio\windows_events.py", line 797, in _poll
  File "chia\server\start_service.py", line 309, in _accept_signal
AttributeError: 'int' object has no attribute 'name'

2024-01-16T17:27:20.564 harvester harvester_server        : ERROR    Caught exception: AttributeError: 'int' object has no attribute 'name'
Traceback (most recent call last):
  File "chia\util\log_exceptions.py", line 20, in log_exceptions
  File "chia\server\ws_connection.py", line 310, in close
  File "chia\server\server.py", line 558, in connection_closed
  File "chia\harvester\harvester.py", line 181, in on_disconnect
  File "chia\plotting\manager.py", line 175, in stop_refreshing
  File "threading.py", line 1096, in join
  File "threading.py", line 1116, in _wait_for_tstate_lock
  File "chia\server\start_service.py", line 309, in _accept_signal
AttributeError: 'int' object has no attribute 'name'

2024-01-16T17:27:30.869 wallet chia.rpc.rpc_server        : WARNING  Cannot connect to daemon at ws://localhost:55400
2024-01-16T17:27:30.884 wallet chia.wallet.wallet_node    : WARNING  Can not connect to keychain at wss://localhost:55400.
2024-01-16T17:28:28.497 full_node chia.server.start_service: ERROR    fatal uncaught exception: DatabaseError: database disk image is malformed
Traceback (most recent call last):
  File "chia\util\log_exceptions.py", line 20, in log_exceptions
  File "chia\server\start_service.py", line 321, in async_run
  File "asyncio\runners.py", line 44, in run
  File "asyncio\base_events.py", line 649, in run_until_complete
  File "chia\server\start_full_node.py", line 83, in async_main
  File "chia\server\start_service.py", line 195, in run
  File "contextlib.py", line 199, in __aenter__
  File "chia\server\start_service.py", line 212, in manage
  File "contextlib.py", line 619, in enter_async_context
  File "contextlib.py", line 199, in __aenter__
  File "chia\full_node\full_node.py", line 268, in manage
  File "chia\consensus\blockchain.py", line 160, in create
  File "chia\consensus\blockchain.py", line 172, in _load_chain_from_store
  File "chia\full_node\block_height_map.py", line 78, in create
  File "aiosqlite\context.py", line 39, in __aenter__
  File "aiosqlite\core.py", line 190, in execute
  File "aiosqlite\core.py", line 133, in _execute
  File "aiosqlite\core.py", line 106, in run
sqlite3.DatabaseError: database disk image is malformed

2024-01-16T17:29:30.342 farmer chia.farmer.farmer         : ERROR    Exception in GET /pool_info https://pool.poolchia.com, Cannot connect to host pool.poolchia.com:443 ssl:<ssl.SSLContext object at 0x00000215BB972C40> [None]
2024-01-16T17:29:50.805 full_node chia.server.start_service: ERROR    fatal uncaught exception: DatabaseError: database disk image is malformed
Traceback (most recent call last):
  File "chia\util\log_exceptions.py", line 20, in log_exceptions
  File "chia\server\start_service.py", line 321, in async_run
  File "asyncio\runners.py", line 44, in run
  File "asyncio\base_events.py", line 649, in run_until_complete
  File "chia\server\start_full_node.py", line 83, in async_main
  File "chia\server\start_service.py", line 195, in run
  File "contextlib.py", line 199, in __aenter__
  File "chia\server\start_service.py", line 212, in manage
  File "contextlib.py", line 619, in enter_async_context
  File "contextlib.py", line 199, in __aenter__
  File "chia\full_node\full_node.py", line 268, in manage
  File "chia\consensus\blockchain.py", line 160, in create
  File "chia\consensus\blockchain.py", line 172, in _load_chain_from_store
  File "chia\full_node\block_height_map.py", line 78, in create
  File "aiosqlite\context.py", line 39, in __aenter__
  File "aiosqlite\core.py", line 190, in execute
  File "aiosqlite\core.py", line 133, in _execute
  File "aiosqlite\core.py", line 106, in run
sqlite3.DatabaseError: database disk image is malformed

2024-01-16T17:32:36.707 farmer chia.farmer.farmer         : ERROR    Exception in GET /pool_info https://pool.poolchia.com, Cannot connect to host pool.poolchia.com:443 ssl:<ssl.SSLContext object at 0x00000215BB972040> [None]
2024-01-16T17:35:30.179 wallet chia.wallet.wallet_state_manager: ERROR    Failed to add coin_state: CoinState { coin: Coin { parent_coin_info: 41127814ea00cdc381715574388e16bf234a151302e3a13f422a4572e06b06fd, puzzle_hash: a33a348159a3433b1d87f9e76cd4ca7f870ca3fd6e3be4a482ea102148614b77, amount: 1 }, spent_height: Some(2462769), created_height: Some(2432612) }, error: 'int' object has no attribute 'name'
Traceback (most recent call last):
  File "chia\wallet\wallet_state_manager.py", line 1709, in _add_coin_states
  File "chia\wallet\wallet_node.py", line 1661, in fetch_children
  File "chia\wallet\wallet_node.py", line 1471, in validate_received_state_from_peer
  File "chia\wallet\wallet_node.py", line 1546, in validate_block_inclusion
  File "chia\wallet\util\wallet_sync_utils.py", line 327, in fetch_header_blocks_in_range
  File "chia\wallet\util\wallet_sync_utils.py", line 283, in _fetch_header_blocks_inner
  File "chia\server\ws_connection.py", line 538, in call_api
  File "chia\util\streamable.py", line 622, in from_bytes
  File "chia\util\streamable.py", line 609, in parse
  File "chia\util\streamable.py", line 424, in <lambda>
  File "chia\util\streamable.py", line 384, in parse_list
  File "chia\util\streamable.py", line 609, in parse
  File "chia\util\streamable.py", line 609, in parse
  File "chia\util\streamable.py", line 609, in parse
  File "chia\util\streamable.py", line 413, in <lambda>
  File "chia\util\streamable.py", line 358, in parse_optional
  File "chia\server\start_service.py", line 309, in _accept_signal
AttributeError: 'int' object has no attribute 'name'
2024-01-16T17:35:39.564 farmer chia.farmer.farmer         : ERROR    Exception in GET /pool_info https://pool.poolchia.com, Cannot connect to host pool.poolchia.com:443 ssl:<ssl.SSLContext object at 0x00000215BB87DFC0> [None]
2024-01-16T17:35:45.754 harvester chia.server.start_service: ERROR    fatal uncaught exception: AttributeError: 'int' object has no attribute 'name'
Traceback (most recent call last):
  File "chia\util\log_exceptions.py", line 20, in log_exceptions
  File "chia\server\start_service.py", line 321, in async_run
  File "asyncio\runners.py", line 44, in run
  File "asyncio\base_events.py", line 636, in run_until_complete
  File "asyncio\windows_events.py", line 321, in run_forever
  File "asyncio\base_events.py", line 603, in run_forever
  File "asyncio\base_events.py", line 1871, in _run_once
  File "asyncio\windows_events.py", line 444, in select
  File "asyncio\windows_events.py", line 797, in _poll
  File "chia\server\start_service.py", line 309, in _accept_signal
AttributeError: 'int' object has no attribute 'name'

2024-01-16T17:35:46.288 farmer chia.server.start_service  : ERROR    fatal uncaught exception: AttributeError: 'int' object has no attribute 'name'
Traceback (most recent call last):
  File "chia\util\log_exceptions.py", line 20, in log_exceptions
  File "chia\server\start_service.py", line 321, in async_run
  File "asyncio\runners.py", line 44, in run
  File "asyncio\base_events.py", line 636, in run_until_complete
  File "asyncio\windows_events.py", line 321, in run_forever
  File "asyncio\base_events.py", line 603, in run_forever
  File "asyncio\base_events.py", line 1871, in _run_once
  File "asyncio\windows_events.py", line 444, in select
  File "asyncio\windows_events.py", line 797, in _poll
  File "chia\server\start_service.py", line 309, in _accept_signal
AttributeError: 'int' object has no attribute 'name'
Sakuya-CN commented 9 months ago

Delete the snapshot blockchain_v2_mainnet.sqlite file and restart the chia-gui program. Everything starts normally and the program is automatically generated. blockchain_v2_mainnet.sqlite blockchain_v2_mainnet.sqlite-shm blockchain_v2_mainnet.sqlite-wal It’s just that the block height has changed to 0. This will waste too much time for me. I don’t understand why the blockchain_v2_mainnet.sqlite file of the snapshot cannot be used normally.

wjblanke commented 9 months ago

You need to stop chia, reboot.

delete all these files

blockchain_v2_mainnet.sqlite blockchain_v2_mainnet.sqlite-shm blockchain_v2_mainnet.sqlite-wal

Now get the torrent and put it in that folder. Restart chia.

If you see this in the log, try the above again

sqlite3.DatabaseError: database disk image is malformed

It means the database file is not OK.