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] Unexpected exception trying to send to websocket: code = 1006 #9923

Closed avb1213 closed 2 years ago

avb1213 commented 2 years ago

What happened?

Hello. From 2-3 month ago chia node start periodically (3-4 times in month) stop syncing. After restart it syncing more then 10-12 hours or even more. From debug.log: 2022-01-24T13:27:19.932 daemon chia.daemon.server : ERROR Unexpected exception trying to send to websocket: code = 1006 (connection closed abnormally [internal])

Version

1.2.11

What platform are you using?

Linux

What ui mode are you using?

CLI

Relevant log output

2022-01-24T13:27:19.932 daemon chia.daemon.server         : ERROR    Unexpected exception trying to send to websocket: code = 1006 (connection closed abnormally [internal]), no reason Traceback (most recent call last):
  File "/home/user/chia-blockchain/venv/lib/python3.8/site-packages/websockets/protocol.py", line 827, in transfer_data
    message = await self.read_message()
  File "/home/user/chia-blockchain/venv/lib/python3.8/site-packages/websockets/protocol.py", line 895, in read_message
    frame = await self.read_data_frame(max_size=self.max_size)
  File "/home/user/chia-blockchain/venv/lib/python3.8/site-packages/websockets/protocol.py", line 971, in read_data_frame
    frame = await self.read_frame(max_size)
  File "/home/user/chia-blockchain/venv/lib/python3.8/site-packages/websockets/protocol.py", line 1047, in read_frame
    frame = await Frame.read(
  File "/home/user/chia-blockchain/venv/lib/python3.8/site-packages/websockets/framing.py", line 105, in read
    data = await reader(2)
  File "/usr/lib/python3.8/asyncio/streams.py", line 721, in readexactly
    raise exceptions.IncompleteReadError(incomplete, n)
asyncio.exceptions.IncompleteReadError: 0 bytes read on a total of 2 expected bytes

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/user/chia-blockchain/chia/daemon/server.py", line 210, in safe_handle
    await socket.send(response)
  File "/home/user/chia-blockchain/venv/lib/python3.8/site-packages/websockets/protocol.py", line 555, in send
    await self.ensure_open()
  File "/home/user/chia-blockchain/venv/lib/python3.8/site-packages/websockets/protocol.py", line 803, in ensure_open
    raise self.connection_closed_exc()
websockets.exceptions.ConnectionClosedError: code = 1006 (connection closed abnormally [internal]), no reason

2022-01-24T13:27:20.818 daemon chia.daemon.server         : ERROR    Unexpected exception trying to send to websocket: code = 1006 (connection closed abnormally [internal]), no reason Traceback (most recent call last):
  File "/home/user/chia-blockchain/venv/lib/python3.8/site-packages/websockets/protocol.py", line 827, in transfer_data
    message = await self.read_message()
  File "/home/user/chia-blockchain/venv/lib/python3.8/site-packages/websockets/protocol.py", line 895, in read_message
    frame = await self.read_data_frame(max_size=self.max_size)
  File "/home/user/chia-blockchain/venv/lib/python3.8/site-packages/websockets/protocol.py", line 971, in read_data_frame
    frame = await self.read_frame(max_size)
  File "/home/user/chia-blockchain/venv/lib/python3.8/site-packages/websockets/protocol.py", line 1047, in read_frame
    frame = await Frame.read(
  File "/home/user/chia-blockchain/venv/lib/python3.8/site-packages/websockets/framing.py", line 105, in read
    data = await reader(2)
  File "/usr/lib/python3.8/asyncio/streams.py", line 721, in readexactly
    raise exceptions.IncompleteReadError(incomplete, n)
asyncio.exceptions.IncompleteReadError: 0 bytes read on a total of 2 expected bytes

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/user/chia-blockchain/chia/daemon/server.py", line 210, in safe_handle
    await socket.send(response)
  File "/home/user/chia-blockchain/venv/lib/python3.8/site-packages/websockets/protocol.py", line 555, in send
    await self.ensure_open()
  File "/home/user/chia-blockchain/venv/lib/python3.8/site-packages/websockets/protocol.py", line 803, in ensure_open
    raise self.connection_closed_exc()
websockets.exceptions.ConnectionClosedError: code = 1006 (connection closed abnormally [internal]), no reason
avb1213 commented 2 years ago

Now, after full_node restart and wait for 24 hours to sync I have this error:

(venv) user@vm1:~/chia-blockchain$ chia show -s
Exception from 'show' Traceback (most recent call last):
  File "/home/user/chia-blockchain/chia/cmds/show.py", line 41, in show_async
    blockchain_state = await client.get_blockchain_state()
  File "/home/user/chia-blockchain/chia/rpc/full_node_rpc_client.py", line 27, in get_blockchain_state
    response = await self.fetch("get_blockchain_state", {})
  File "/home/user/chia-blockchain/chia/rpc/rpc_client.py", line 49, in fetch
    raise ValueError(res_json)
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}
esaung commented 2 years ago

we have a lot of changes coming in our next release. We'll have to see if this issues persists in the upcoming build.

avb1213 commented 2 years ago

Thanx for reply. I just made an experiment. Install chia-blockchain on fresh Ubuntu 20.04. It's synced after 2,5 days, but still have a lot of errors in log:

2022-01-31T09:50:31.376 daemon chia.daemon.server         : ERROR    Unexpected exception trying to send to websocket: code = 1006 (connection closed abnormally [internal]), no reason Traceback (most recent call last):
  File "/home/user/chia-blockchain/venv/lib/python3.8/site-packages/websockets/protocol.py", line 827, in transfer_data
    message = await self.read_message()
  File "/home/user/chia-blockchain/venv/lib/python3.8/site-packages/websockets/protocol.py", line 895, in read_message
    frame = await self.read_data_frame(max_size=self.max_size)
  File "/home/user/chia-blockchain/venv/lib/python3.8/site-packages/websockets/protocol.py", line 971, in read_data_frame
    frame = await self.read_frame(max_size)
  File "/home/user/chia-blockchain/venv/lib/python3.8/site-packages/websockets/protocol.py", line 1047, in read_frame
    frame = await Frame.read(
  File "/home/user/chia-blockchain/venv/lib/python3.8/site-packages/websockets/framing.py", line 105, in read
    data = await reader(2)
  File "/usr/lib/python3.8/asyncio/streams.py", line 721, in readexactly
    raise exceptions.IncompleteReadError(incomplete, n)
asyncio.exceptions.IncompleteReadError: 0 bytes read on a total of 2 expected bytes

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/user/chia-blockchain/chia/daemon/server.py", line 210, in safe_handle
    await socket.send(response)
  File "/home/user/chia-blockchain/venv/lib/python3.8/site-packages/websockets/protocol.py", line 555, in send
    await self.ensure_open()
  File "/home/user/chia-blockchain/venv/lib/python3.8/site-packages/websockets/protocol.py", line 803, in ensure_open
    raise self.connection_closed_exc()
websockets.exceptions.ConnectionClosedError: code = 1006 (connection closed abnormally [internal]), no reason
github-actions[bot] commented 2 years ago

This issue has not been updated in 14 days and is now flagged as stale. If this issue is still affecting you and in need of further review, please comment on it with an update to keep it from auto closing in 7 days.

github-actions[bot] commented 2 years ago

This issue was automatically closed because it has been flagged as stale, and subsequently passed 7 days with no further activity from the submitter or watchers.