MaskRay / telegramircd

Control Telegram user account with IRC
Apache License 2.0
66 stars 15 forks source link

Server hangs after receiving image files #27

Open termermc opened 3 years ago

termermc commented 3 years ago

After receiving an image file (doesn't seem to happen for gifs), the server will hang with this error:

May 16 19:00:55 vps-c41f521a python3[306830]: Downloading file in chunks of 131072 bytes
May 16 19:00:55 vps-c41f521a python3[306830]: 127.0.0.1 [16/May/2021:19:00:55 +0000] "GET /document/1.jpg HTTP/1.0" 500 207 "-" "Mozilla/5.0 (compatible; The Lounge IRC Client; +https://github.com/thelounge/thelounge) facebookexternalhit/>
May 16 19:01:10 vps-c41f521a python3[306830]: Downloading file in chunks of 131072 bytes
May 16 19:01:10 vps-c41f521a python3[306830]: Unhandled exception while processing TLMessage(msg_id=6962965205144311809, seq_no=95, obj=RpcResult(req_msg_id=6962965204889086836, body=None, error=RpcError(error_code=406, error_message='FIL>
                                              Traceback (most recent call last):
                                                File "/home/telegramircd/.local/lib/python3.8/site-packages/telethon/network/mtprotosender.py", line 486, in _recv_loop
                                                  self._process_message(message)
                                                File "/home/telegramircd/.local/lib/python3.8/site-packages/telethon/network/mtprotosender.py", line 506, in _process_message
                                                  handler(message)
                                                File "/home/telegramircd/.local/lib/python3.8/site-packages/telethon/network/mtprotosender.py", line 528, in _handle_rpc_result
                                                  error = rpc_message_to_error(rpc_result.error)
                                                File "/home/telegramircd/.local/lib/python3.8/site-packages/telethon/errors/__init__.py", line 70, in rpc_message_to_error
                                                  return cls(rpc_error.error_message)
                                                File "/home/telegramircd/.local/lib/python3.8/site-packages/telethon/errors/rpcbaseerrors.py", line 76, in __init__
                                                  super().__init__(message)
                                              TypeError: __init__() missing 1 required positional argument: 'message'

The server still sends out messages from Telegram, but cannot send them if you try to send a message via IRC. The HTTP server also hangs. This does not stop until a restart, making this a very big problem. Any idea what's wrong here? Perhaps a telegram library needs to be upgraded?

Petraea commented 3 years ago

Can confirm this occurs only when accessing images.

There is more in this error message for me: on_telegram_update 'UpdateServiceNotification' {'_': 'UpdateServiceNotification', 'type': 'API_ERROR_UPDATE_UNOFFICIAL_224', 'message': 'Error. Please update your app to the latest version or switch to the official version of Telegram.', 'media': {'_': 'MessageMediaEmpty'}, 'entities': [], 'popup': True, 'inbox_date': None}

I guess this means the associated Telethon version isn't keeping up with the current API.

termermc commented 3 years ago

If it's simply an issue with Telethon, it would be good at least to catch the error in a way that doesn't make the server hang. I can handle images not working, but if that also means I can't receive messages at all, it's a big problem.