NonProjects / tgbox

Encrypted cloud storage Protocol based on Telegram
https://tgbox.readthedocs.io/
GNU Lesser General Public License v2.1
34 stars 4 forks source link

Server closed the connection: 0 bytes read on a total of 8 expected bytes #30

Closed NotStatilko closed 7 months ago

NotStatilko commented 1 year ago
:2023-05-04 ^ 21:45:56: WARNING:telethon.network.connection.connection~_recv_loop{334} ::: Server closed the connection: 0 bytes read on a total of 8 expected bytes
:2023-05-04 ^ 21:45:58: ERROR:telethon.network.mtprotosender~_recv_loop{519} ::: Unhandled error while receiving data
Traceback (most recent call last):
  File "/home/pronet/.local/lib/python3.9/site-packages/telethon/network/mtprotosender.py", line 505, in _recv_loop
    body = await self._connection.recv()
  File "/home/pronet/.local/lib/python3.9/site-packages/telethon/network/connection/connection.py", line 301, in recv
    raise err
  File "/home/pronet/.local/lib/python3.9/site-packages/telethon/network/connection/connection.py", line 332, in _recv_loop
    data = await self._recv()
  File "/home/pronet/.local/lib/python3.9/site-packages/telethon/network/connection/connection.py", line 369, in _recv
    return await self._codec.read_packet(self._reader)
  File "/home/pronet/.local/lib/python3.9/site-packages/telethon/network/connection/tcpfull.py", line 25, in read_packet
    packet_len_seq = await reader.readexactly(8)  # 4 and 4
  File "/usr/lib/python3.9/asyncio/streams.py", line 721, in readexactly
    raise exceptions.IncompleteReadError(incomplete, n)
asyncio.exceptions.IncompleteReadError: 0 bytes read on a total of 8 expected bytes
NotStatilko commented 1 year ago

It seems that Telegram close connection when we make many requests per second. Also seems that this was already fixed in the https://github.com/LonamiWebs/Telethon/commit/ccf67d0f4f188ce46d17424219bba9b370eb8b0a commit. Probably we will need to just bump the telethon version to the latest that includes this fix in future. As possible workaround just do not spam servers :)

NotStatilko commented 7 months ago

See https://github.com/NonProjects/tgbox/commit/d264297e3295688fca11d83dd9f72363300097df commentary. Try to lower amount of files uploaded at the same time with fast upload if you experience this issue. It seems that there is nothing that we can do to fix this problem as for now.