Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: OSError: Connection lost #225

Open
jiuxiaofu opened this issue Feb 2, 2025 · 0 comments
Open

[Bug]: OSError: Connection lost #225

jiuxiaofu opened this issue Feb 2, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@jiuxiaofu
Copy link

telegram_media_downloader version or commit

V2.2.5

What OS are you seeing the problem on?

Other Linux Distro

Python Version

No response

What happened?

使用docker部署,下载群组的全部会话过程中会跳过很多会话未下载,但机器人不显示跳过。对跳过的规划范围再次使用机器人命令下载,则会下载其中一部分,仍有很多会话未被下载。

Expected Behavior

正常下载所有会话

Current Behavior

2025-02-02 10:02:11.620 | ERROR | main:worker:538 - Connection lost
Traceback (most recent call last):

File "/app/media_downloader.py", line 704, in
main()
└ <function main at 0x7f9d49627f60>

File "/app/media_downloader.py", line 678, in main
_exec_loop()
└ <function _exec_loop at 0x7f9d49627d80>

File "/app/media_downloader.py", line 632, in _exec_loop
app.loop.run_until_complete(run_until_all_task_finish())
│ │ │ └ <function run_until_all_task_finish at 0x7f9d49627ce0>
│ │ └ <function BaseEventLoop.run_until_complete at 0x7f9d4cea27a0>
│ └ <_UnixSelectorEventLoop running=True closed=False debug=False>
└ <module.app.Application object at 0x7f9d49632650>

File "/usr/local/lib/python3.11/asyncio/base_events.py", line 641, in run_until_complete
self.run_forever()
│ └ <function BaseEventLoop.run_forever at 0x7f9d4cea2700>
└ <_UnixSelectorEventLoop running=True closed=False debug=False>
File "/usr/local/lib/python3.11/asyncio/base_events.py", line 608, in run_forever
self._run_once()
│ └ <function BaseEventLoop._run_once at 0x7f9d4ce58540>
└ <_UnixSelectorEventLoop running=True closed=False debug=False>
File "/usr/local/lib/python3.11/asyncio/base_events.py", line 1936, in _run_once
handle._run()
│ └ <function Handle._run at 0x7f9d4d6520c0>
└ <Handle <TaskStepMethWrapper object at 0x7f9d44bef970>()>
File "/usr/local/lib/python3.11/asyncio/events.py", line 84, in _run
self._context.run(self._callback, *self._args)
│ │ │ │ │ └ <member '_args' of 'Handle' objects>
│ │ │ │ └ <Handle <TaskStepMethWrapper object at 0x7f9d44bef970>()>
│ │ │ └ <member '_callback' of 'Handle' objects>
│ │ └ <Handle <TaskStepMethWrapper object at 0x7f9d44bef970>()>
│ └ <member '_context' of 'Handle' objects>
└ <Handle <TaskStepMethWrapper object at 0x7f9d44bef970>()>

File "/app/media_downloader.py", line 536, in worker
await download_task(client, message, node)
│ │ │ └ <module.app.TaskNode object at 0x7f9d490da010>
│ │ └ pyrogram.types.Message(id=6311, sender_chat=pyrogram.types.Chat(id=-1001933319296, type=pyrogram.enums.ChatType.CHANNEL, is_v...
│ └ <module.pyrogram_extension.HookClient object at 0x7f9d496649d0>
└ <function download_task at 0x7f9d496277e0>

File "/app/media_downloader.py", line 303, in download_task
download_status, file_name = await download_media(
└ <function download_media at 0x7f9d49627920>

File "/app/module/pyrogram_extension.py", line 761, in inner
status, file_name = await func(client, message, media_types, file_formats, node)
│ │ │ │ │ └ <module.app.TaskNode object at 0x7f9d490da010>
│ │ │ │ └ ordereddict([('audio', ['all']), ('document', ['all']), ('video', ['all'])])
│ │ │ └ ['audio', 'photo', 'video', 'document', 'voice', 'video_note']
│ │ └ pyrogram.types.Message(id=6311, sender_chat=pyrogram.types.Chat(id=-1001933319296, type=pyrogram.enums.ChatType.CHANNEL, is_v...
│ └ <module.pyrogram_extension.HookClient object at 0x7f9d496649d0>
└ <function download_media at 0x7f9d49627880>

File "/app/media_downloader.py", line 398, in download_media
message = await fetch_message(client, message)
│ │ └ pyrogram.types.Message(id=6311, sender_chat=pyrogram.types.Chat(id=-1001933319296, type=pyrogram.enums.ChatType.CHANNEL, is_v...
│ └ <module.pyrogram_extension.HookClient object at 0x7f9d496649d0>
└ <function fetch_message at 0x7f9d4a451620>

File "/app/module/pyrogram_extension.py", line 969, in fetch_message
return await client.get_messages(
│ └ <function GetMessages.get_messages at 0x7f9d4ab1dee0>
└ <module.pyrogram_extension.HookClient object at 0x7f9d496649d0>

File "/usr/local/lib/python3.11/site-packages/pyrogram/methods/messages/get_messages.py", line 115, in get_messages
r = await self.invoke(rpc, sleep_threshold=-1)
│ │ └ pyrogram.raw.functions.channels.GetMessages(channel=pyrogram.raw.types.InputPeerChannel(channel_id=1933319296, access_hash=-1...
│ └ <function Invoke.invoke at 0x7f9d4ab1f1a0>
└ <module.pyrogram_extension.HookClient object at 0x7f9d496649d0>
File "/usr/local/lib/python3.11/site-packages/pyrogram/methods/advanced/invoke.py", line 94, in invoke
r = await session.invoke(
│ └ <function Session.invoke at 0x7f9d4b620ea0>
└ <module.pyrogram_extension.HookSession object at 0x7f9d493401d0>
File "/usr/local/lib/python3.11/site-packages/pyrogram/session/session.py", line 424, in invoke
return await self.invoke(query, retries - 1, timeout)
│ │ │ │ └ 15
│ │ │ └ 10
│ │ └ pyrogram.raw.functions.channels.GetMessages(channel=pyrogram.raw.types.InputPeerChannel(channel_id=1933319296, access_hash=-1...
│ └ <function Session.invoke at 0x7f9d4b620ea0>
└ <module.pyrogram_extension.HookSession object at 0x7f9d493401d0>
File "/usr/local/lib/python3.11/site-packages/pyrogram/session/session.py", line 424, in invoke
return await self.invoke(query, retries - 1, timeout)
│ │ │ │ └ 15
│ │ │ └ 9
│ │ └ pyrogram.raw.functions.channels.GetMessages(channel=pyrogram.raw.types.InputPeerChannel(channel_id=1933319296, access_hash=-1...
│ └ <function Session.invoke at 0x7f9d4b620ea0>
└ <module.pyrogram_extension.HookSession object at 0x7f9d493401d0>
File "/usr/local/lib/python3.11/site-packages/pyrogram/session/session.py", line 424, in invoke
return await self.invoke(query, retries - 1, timeout)
│ │ │ │ └ 15
│ │ │ └ 8
│ │ └ pyrogram.raw.functions.channels.GetMessages(channel=pyrogram.raw.types.InputPeerChannel(channel_id=1933319296, access_hash=-1...
│ └ <function Session.invoke at 0x7f9d4b620ea0>
└ <module.pyrogram_extension.HookSession object at 0x7f9d493401d0>
[Previous line repeated 7 more times]
File "/usr/local/lib/python3.11/site-packages/pyrogram/session/session.py", line 414, in invoke
raise e from None
File "/usr/local/lib/python3.11/site-packages/pyrogram/session/session.py", line 401, in invoke
return await self.send(query, timeout=timeout)
│ │ │ └ 15
│ │ └ pyrogram.raw.functions.channels.GetMessages(channel=pyrogram.raw.types.InputPeerChannel(channel_id=1933319296, access_hash=-1...
│ └ <function Session.send at 0x7f9d4b620e00>
└ <module.pyrogram_extension.HookSession object at 0x7f9d493401d0>
File "/usr/local/lib/python3.11/site-packages/pyrogram/session/session.py", line 352, in send
raise e
File "/usr/local/lib/python3.11/site-packages/pyrogram/session/session.py", line 349, in send
await self.connection.send(payload)
│ │ │ └ b'JU\xf6\xa5\x8e\x7f1L@3\x91\x11\xf1\x03\x9aG\xd1\xcf\x82\xf4y\xb5S\x14\x8f\xdf\xe4\t\x15\xa7\xd7\xb0_\xe7\x04r\xec\xc44\xf9...
│ │ └ <function Connection.send at 0x7f9d4b646340>
│ └ <pyrogram.connection.connection.Connection object at 0x7f9d45fc4210>
└ <module.pyrogram_extension.HookSession object at 0x7f9d493401d0>
File "/usr/local/lib/python3.11/site-packages/pyrogram/connection/connection.py", line 78, in send
await self.protocol.send(data)
│ │ │ └ b'JU\xf6\xa5\x8e\x7f1L@3\x91\x11\xf1\x03\x9aG\xd1\xcf\x82\xf4y\xb5S\x14\x8f\xdf\xe4\t\x15\xa7\xd7\xb0_\xe7\x04r\xec\xc44\xf9...
│ │ └ <function TCPAbridged.send at 0x7f9d4b644c20>
│ └ <pyrogram.connection.transport.tcp.tcp_abridged.TCPAbridged object at 0x7f9d456026d0>
└ <pyrogram.connection.connection.Connection object at 0x7f9d45fc4210>
File "/usr/local/lib/python3.11/site-packages/pyrogram/connection/transport/tcp/tcp_abridged.py", line 38, in send
await super().send(
File "/usr/local/lib/python3.11/site-packages/pyrogram/connection/transport/tcp/tcp.py", line 142, in send
raise OSError(e)

OSError: Connection lost

Possible Solution

No response

Steps to Reproduce

No response

Relevant log output

@jiuxiaofu jiuxiaofu added the bug Something isn't working label Feb 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant