Mayuri-Chan / pyrofork

Pyrogram fork with Adjustable web page preview, Quote Reply, Story & Topics Support, Mongodb session storage, and much more. go to https://pyrofork.wulan17.top/ for documentation.
https://pyrofork.wulan17.top
GNU Lesser General Public License v3.0
162 stars 78 forks source link

socket.send() raised exception #92

Open fivepe opened 2 months ago

fivepe commented 2 months ago

Checklist

Description

The connection is lost and the robot cannot automatically restore the connection, resulting in no response. It needs to be restarted to normalize.

Steps to reproduce

Connection lost Traceback (most recent call last): File "/usr/local/lib/python3.8/dist-packages/pyrogram/dispatcher.py", line 414, in handler_worker await parser(update, users, chats) File "/usr/local/lib/python3.8/dist-packages/pyrogram/dispatcher.py", line 107, in message_parser await pyrogram.types.Message._parse(self.client, update.message, users, chats, File "/usr/local/lib/python3.8/dist-packages/pyrogram/types/messages_and_media/message.py", line 946, in _parse parsed_message.pinned_message = await client.get_messages( File "/usr/local/lib/python3.8/dist-packages/pyrogram/methods/messages/get_messages.py", line 117, in get_messages r = await self.invoke(rpc, sleep_threshold=-1) File "/usr/local/lib/python3.8/dist-packages/pyrogram/methods/advanced/invoke.py", line 80, in invoke r = await self.session.invoke( File "/usr/local/lib/python3.8/dist-packages/pyrogram/session/session.py", line 438, in invoke return await self.invoke(query, retries - 1, timeout) File "/usr/local/lib/python3.8/dist-packages/pyrogram/session/session.py", line 438, in invoke return await self.invoke(query, retries - 1, timeout) File "/usr/local/lib/python3.8/dist-packages/pyrogram/session/session.py", line 438, in invoke return await self.invoke(query, retries - 1, timeout) [Previous line repeated 7 more times] File "/usr/local/lib/python3.8/dist-packages/pyrogram/session/session.py", line 428, in invoke raise e from None File "/usr/local/lib/python3.8/dist-packages/pyrogram/session/session.py", line 415, in invoke return await self.send(query, timeout=timeout) File "/usr/local/lib/python3.8/dist-packages/pyrogram/session/session.py", line 355, in send raise e File "/usr/local/lib/python3.8/dist-packages/pyrogram/session/session.py", line 352, in send await self.connection.send(payload) File "/usr/local/lib/python3.8/dist-packages/pyrogram/connection/connection.py", line 81, in send await self.protocol.send(data) File "/usr/local/lib/python3.8/dist-packages/pyrogram/connection/transport/tcp/tcp_abridged.py", line 39, in send await super().send( File "/usr/local/lib/python3.8/dist-packages/pyrogram/connection/transport/tcp/tcp.py", line 150, in send raise OSError(e) OSError: Connection lost socket.send() raised exception. socket.send() raised exception. socket.send() raised exception. socket.send() raised exception. socket.send() raised exception. socket.send() raised exception. socket.send() raised exception. socket.send() raised exception. socket.send() raised exception. socket.send() raised exception. [10] Retrying "updates.GetState" due to: Connection lost socket.send() raised exception.

Code example

No response

Logs

No response

RabbitFored commented 2 months ago

Facing the same issue

InWamos commented 6 days ago

Launch your bot with docker compose and set the following restart policy: restart: on-failure

This will restart your bot every time your internet connection fails. Alternatively just use while True with try-except but I wouldn't recommend you doing this