TelegramPlayGround / pyrogram

PyroGramFORK | Telegram MTProto API framework in Python for users and bots | PyroGramFORK
https://telegramplayground.github.io/pyrogram/
GNU Lesser General Public License v3.0
79 stars 13 forks source link

Handler is closed #79

Closed anasty17 closed 3 weeks ago

anasty17 commented 1 month ago

Checklist

Description

2024-08-22 17:15:39,521 - pyrogram.connection.transport.tcp.tcp - ERROR - Send exception: RuntimeError unable to perform operation on <TCPTransport closed=True reading=False 0x2219c8c0>; the handler is closed

Steps to reproduce

i have never saw this in official lib I notice this in all new mods I can't reproduce this happens when bot idle

Code example

No response

Logs

2024-08-22 17:15:39,521 - pyrogram.connection.transport.tcp.tcp - ERROR - Send exception: RuntimeError unable to perform operation on <TCPTransport closed=True reading=False 0x2219c8c0>; the handler is closed
Traceback (most recent call last):
  File "/usr/local/lib/python3.12/dist-packages/pyrogram/connection/transport/tcp/tcp.py", line 145, in send
    self.writer.write(data)
  File "/usr/lib/python3.12/asyncio/streams.py", line 346, in write
    self._transport.write(data)
  File "uvloop/handles/stream.pyx", line 674, in uvloop.loop.UVStream.write
  File "uvloop/handles/handle.pyx", line 159, in uvloop.loop.UVHandle._ensure_alive
RuntimeError: unable to perform operation on <TCPTransport closed=True reading=False 0x2219c8c0>; the handler is closed
2024-08-23 09:36:44,687 - pyrogram.connection.transport.tcp.tcp - ERROR - Send exception: RuntimeError unable to perform operation on <TCPTransport closed=True reading=False 0xe2cf5c045cc0>; the handler is closed
Traceback (most recent call last):
  File "/usr/local/lib/python3.12/dist-packages/pyrogram/connection/transport/tcp/tcp.py", line 145, in send
    self.writer.write(data)
  File "/usr/lib/python3.12/asyncio/streams.py", line 346, in write
    self._transport.write(data)
  File "uvloop/handles/stream.pyx", line 674, in uvloop.loop.UVStream.write
  File "uvloop/handles/handle.pyx", line 159, in uvloop.loop.UVHandle._ensure_alive
RuntimeError: unable to perform operation on <TCPTransport closed=True reading=False 0xe2cf5c045cc0>; the handler is closed
2024-08-23 09:36:44,731 - pyrogram.connection.transport.tcp.tcp - ERROR - Send exception: RuntimeError unable to perform operation on <TCPTransport closed=True reading=False 0xe2cf5c045cc0>; the handler is closed
Traceback (most recent call last):
  File "/usr/local/lib/python3.12/dist-packages/pyrogram/connection/transport/tcp/tcp.py", line 145, in send
    self.writer.write(data)
  File "/usr/lib/python3.12/asyncio/streams.py", line 346, in write
    self._transport.write(data)
  File "uvloop/handles/stream.pyx", line 674, in uvloop.loop.UVStream.write
  File "uvloop/handles/handle.pyx", line 159, in uvloop.loop.UVHandle._ensure_alive
RuntimeError: unable to perform operation on <TCPTransport closed=True reading=False 0xe2cf5c045cc0>; the handler is closed
2024-08-23 09:36:44,732 - pyrogram.connection.transport.tcp.tcp - ERROR - Send exception: RuntimeError unable to perform operation on <TCPTransport closed=True reading=False 0xe2cf5c045cc0>; the handler is closed
Traceback (most recent call last):
  File "/usr/local/lib/python3.12/dist-packages/pyrogram/connection/transport/tcp/tcp.py", line 145, in send
    self.writer.write(data)
  File "/usr/lib/python3.12/asyncio/streams.py", line 346, in write
    self._transport.write(data)
  File "uvloop/handles/stream.pyx", line 674, in uvloop.loop.UVStream.write
  File "uvloop/handles/handle.pyx", line 159, in uvloop.loop.UVHandle._ensure_alive
RuntimeError: unable to perform operation on <TCPTransport closed=True reading=False 0xe2cf5c045cc0>; the handler is closed
2024-08-23 09:36:44,733 - pyrogram.connection.transport.tcp.tcp - ERROR - Send exception: RuntimeError unable to perform operation on <TCPTransport closed=True reading=False 0xe2cf5c045cc0>; the handler is closed
Traceback (most recent call last):
  File "/usr/local/lib/python3.12/dist-packages/pyrogram/connection/transport/tcp/tcp.py", line 145, in send
    self.writer.write(data)
  File "/usr/lib/python3.12/asyncio/streams.py", line 346, in write
    self._transport.write(data)
  File "uvloop/handles/stream.pyx", line 674, in uvloop.loop.UVStream.write
  File "uvloop/handles/handle.pyx", line 159, in uvloop.loop.UVHandle._ensure_alive
RuntimeError: unable to perform operation on <TCPTransport closed=True reading=False 0xe2cf5c045cc0>; the handler is closed
2024-08-23 09:36:44,767 - pyrogram.connection.transport.tcp.tcp - ERROR - Send exception: RuntimeError unable to perform operation on <TCPTransport closed=True reading=False 0xe2cf5c045cc0>; the handler is closed
Traceback (most recent call last):
  File "/usr/local/lib/python3.12/dist-packages/pyrogram/connection/transport/tcp/tcp.py", line 145, in send
    self.writer.write(data)
  File "/usr/lib/python3.12/asyncio/streams.py", line 346, in write
    self._transport.write(data)
  File "uvloop/handles/stream.pyx", line 674, in uvloop.loop.UVStream.write
  File "uvloop/handles/handle.pyx", line 159, in uvloop.loop.UVHandle._ensure_alive
RuntimeError: unable to perform operation on <TCPTransport closed=True reading=False 0xe2cf5c045cc0>; the handler is closed
2024-08-23 09:36:44,768 - pyrogram.connection.transport.tcp.tcp - ERROR - Send exception: RuntimeError unable to perform operation on <TCPTransport closed=True reading=False 0xe2cf5c045cc0>; the handler is closed
Traceback (most recent call last):
  File "/usr/local/lib/python3.12/dist-packages/pyrogram/connection/transport/tcp/tcp.py", line 145, in send
    self.writer.write(data)
  File "/usr/lib/python3.12/asyncio/streams.py", line 346, in write
    self._transport.write(data)
  File "uvloop/handles/stream.pyx", line 674, in uvloop.loop.UVStream.write
  File "uvloop/handles/handle.pyx", line 159, in uvloop.loop.UVHandle._ensure_alive
RuntimeError: unable to perform operation on <TCPTransport closed=True reading=False 0xe2cf5c045cc0>; the handler is closed
2024-08-23 09:36:44,768 - pyrogram.connection.transport.tcp.tcp - ERROR - Send exception: RuntimeError unable to perform operation on <TCPTransport closed=True reading=False 0xe2cf5c045cc0>; the handler is closed
Traceback (most recent call last):
  File "/usr/local/lib/python3.12/dist-packages/pyrogram/connection/transport/tcp/tcp.py", line 145, in send
    self.writer.write(data)
  File "/usr/lib/python3.12/asyncio/streams.py", line 346, in write
    self._transport.write(data)
  File "uvloop/handles/stream.pyx", line 674, in uvloop.loop.UVStream.write
  File "uvloop/handles/handle.pyx", line 159, in uvloop.loop.UVHandle._ensure_alive
RuntimeError: unable to perform operation on <TCPTransport closed=True reading=False 0xe2cf5c045cc0>; the handler is closed
2024-08-23 09:36:44,768 - pyrogram.connection.transport.tcp.tcp - ERROR - Send exception: RuntimeError unable to perform operation on <TCPTransport closed=True reading=False 0xe2cf5c045cc0>; the handler is closed
Traceback (most recent call last):
  File "/usr/local/lib/python3.12/dist-packages/pyrogram/connection/transport/tcp/tcp.py", line 145, in send
    self.writer.write(data)
  File "/usr/lib/python3.12/asyncio/streams.py", line 346, in write
    self._transport.write(data)
  File "uvloop/handles/stream.pyx", line 674, in uvloop.loop.UVStream.write
  File "uvloop/handles/handle.pyx", line 159, in uvloop.loop.UVHandle._ensure_alive
RuntimeError: unable to perform operation on <TCPTransport closed=True reading=False 0xe2cf5c045cc0>; the handler is closed
2024-08-23 09:36:44,769 - pyrogram.connection.transport.tcp.tcp - ERROR - Send exception: RuntimeError unable to perform operation on <TCPTransport closed=True reading=False 0xe2cf5c045cc0>; the handler is closed
Traceback (most recent call last):
  File "/usr/local/lib/python3.12/dist-packages/pyrogram/connection/transport/tcp/tcp.py", line 145, in send
    self.writer.write(data)
  File "/usr/lib/python3.12/asyncio/streams.py", line 346, in write
    self._transport.write(data)
  File "uvloop/handles/stream.pyx", line 674, in uvloop.loop.UVStream.write
  File "uvloop/handles/handle.pyx", line 159, in uvloop.loop.UVHandle._ensure_alive
RuntimeError: unable to perform operation on <TCPTransport closed=True reading=False 0xe2cf5c045cc0>; the handler is closed
2024-08-23 09:36:44,769 - pyrogram.connection.transport.tcp.tcp - ERROR - Send exception: RuntimeError unable to perform operation on <TCPTransport closed=True reading=False 0xe2cf5c045cc0>; the handler is closed
Traceback (most recent call last):
  File "/usr/local/lib/python3.12/dist-packages/pyrogram/connection/transport/tcp/tcp.py", line 145, in send
    self.writer.write(data)
  File "/usr/lib/python3.12/asyncio/streams.py", line 346, in write
    self._transport.write(data)
  File "uvloop/handles/stream.pyx", line 674, in uvloop.loop.UVStream.write
  File "uvloop/handles/handle.pyx", line 159, in uvloop.loop.UVHandle._ensure_alive
RuntimeError: unable to perform operation on <TCPTransport closed=True reading=False 0xe2cf5c045cc0>; the handler is closed
fivepe commented 3 weeks ago

updated to latest version, this error still occurs

Send exception: RuntimeError unable to perform operation on <TCPTransport closed=True reading=False 0x8dd6630>; the handler is closed
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/dist-packages/pyrogram/connection/transport/tcp/tcp.py", line 145, in send
    self.writer.write(data)
  File "/usr/lib/python3.8/asyncio/streams.py", line 341, in write
    self._transport.write(data)
  File "uvloop/handles/stream.pyx", line 674, in uvloop.loop.UVStream.write
  File "uvloop/handles/handle.pyx", line 159, in uvloop.loop.UVHandle._ensure_alive
RuntimeError: unable to perform operation on <TCPTransport closed=True reading=False 0x8dd6630>; the handler is closed
SpEcHiDe commented 3 weeks ago

I do not get this error in any of my bots.

fivepe commented 1 week ago

As long as I run it for a while, there will be a lot of errors like this. It may also be related to the number of robot users, and the amount of concurrency is relatively high. image

Running multiple clients in one program can easily trigger this error when uploading or downloading at the same time. Personally, I feel that this problem will occur if there are too many concurrent clients.