Forums

Сonnection issues with the Telegram server

Hello everyone! Every few hours, I encounter connection issues with the Telegram server. Here are the errors from my logs. Has anyone experienced something similar?

The program execution resumes after a while, but sometimes the code completely stops, and the program doesn’t run. This undermines all my efforts.

Traceback (most recent call last):
  File "/home/happyrusl/.local/lib/python3.10/site-packages/httpx/_transports/default.py", line 101, in map_httpcore_exceptions
    yield
  File "/home/happyrusl/.local/lib/python3.10/site-packages/httpx/_transports/default.py", line 394, in handle_async_request
    resp = await self._pool.handle_async_request(req)
  File "/home/happyrusl/.local/lib/python3.10/site-packages/httpcore/_async/connection_pool.py", line 256, in handle_async_request
    raise exc from None
  File "/home/happyrusl/.local/lib/python3.10/site-packages/httpcore/_async/connection_pool.py", line 236, in handle_async_request
    response = await connection.handle_async_request(
  File "/home/happyrusl/.local/lib/python3.10/site-packages/httpcore/_async/http_proxy.py", line 343, in handle_async_request
    return await self._connection.handle_async_request(request)
  File "/home/happyrusl/.local/lib/python3.10/site-packages/httpcore/_async/http11.py", line 136, in handle_async_request
    raise exc
  File "/home/happyrusl/.local/lib/python3.10/site-packages/httpcore/_async/http11.py", line 106, in handle_async_request
    ) = await self._receive_response_headers(**kwargs)
  File "/home/happyrusl/.local/lib/python3.10/site-packages/httpcore/_async/http11.py", line 177, in _receive_response_headers
    event = await self._receive_event(timeout=timeout)
  File "/home/happyrusl/.local/lib/python3.10/site-packages/httpcore/_async/http11.py", line 231, in _receive_event
    raise RemoteProtocolError(msg)
httpcore.RemoteProtocolError: Server disconnected without sending a response.

[edit by admin: formatting]

That looks like it literally the Telegram servers disconnecting a long-running connection that your bot's library is using to receive messages from users of your bot. Is there some way you can configure the library to automatically reconnect (I'd expect it to do that by default, but perhaps you need to tell it to do that).