home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
71.06k stars 29.72k forks source link

/usr/local/lib/python3.12/site-packages/telegram/ext/_updater.py:411 #116722

Open Johnyboy1984 opened 4 months ago

Johnyboy1984 commented 4 months ago

The problem

Exception happened while polling for updates. Traceback (most recent call last): File "/usr/local/lib/python3.12/site-packages/httpx/_transports/default.py", line 69, in map_httpcore_exceptions yield File "/usr/local/lib/python3.12/site-packages/httpx/_transports/default.py", line 373, in handle_async_request resp = await self._pool.handle_async_request(req) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/httpcore/_async/connection_pool.py", line 216, in handle_async_request raise exc from None File "/usr/local/lib/python3.12/site-packages/httpcore/_async/connection_pool.py", line 196, in handle_async_request response = await connection.handle_async_request( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/httpcore/_async/connection.py", line 101, in handle_async_request return await self._connection.handle_async_request(request) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/httpcore/_async/http11.py", line 143, in handle_async_request raise exc File "/usr/local/lib/python3.12/site-packages/httpcore/_async/http11.py", line 113, in handle_async_request ) = await self._receive_response_headers(**kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/httpcore/_async/http11.py", line 186, in _receive_response_headers event = await self._receive_event(timeout=timeout) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/httpcore/_async/http11.py", line 224, in _receive_event data = await self._network_stream.read( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/httpcore/_backends/anyio.py", line 32, in read with map_exceptions(exc_map): File "/usr/local/lib/python3.12/contextlib.py", line 158, in exit self.gen.throw(value) File "/usr/local/lib/python3.12/site-packages/httpcore/_exceptions.py", line 14, in map_exceptions raise to_exc(exc) from exc httpcore.ReadError

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "/usr/local/lib/python3.12/site-packages/telegram/request/_httpxrequest.py", line 276, in do_request res = await self._client.request( ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/httpx/_client.py", line 1574, in request return await self.send(request, auth=auth, follow_redirects=follow_redirects) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/httpx/_client.py", line 1661, in send response = await self._send_handling_auth( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/httpx/_client.py", line 1689, in _send_handling_auth response = await self._send_handling_redirects( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/httpx/_client.py", line 1726, in _send_handling_redirects response = await self._send_single_request(request) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/httpx/_client.py", line 1763, in _send_single_request response = await transport.handle_async_request(request) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/httpx/_transports/default.py", line 372, in handle_async_request with map_httpcore_exceptions(): File "/usr/local/lib/python3.12/contextlib.py", line 158, in exit self.gen.throw(value) File "/usr/local/lib/python3.12/site-packages/httpx/_transports/default.py", line 86, in map_httpcore_exceptions raise mapped_exc(message) from exc httpx.ReadError

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "/usr/local/lib/python3.12/site-packages/telegram/ext/_updater.py", line 742, in _network_loop_retry if not await do_action(): ^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/telegram/ext/_updater.py", line 736, in do_action return action_cb_task.result() ^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/telegram/ext/_updater.py", line 387, in polling_action_cb raise exc File "/usr/local/lib/python3.12/site-packages/telegram/ext/_updater.py", line 376, in polling_action_cb updates = await self.bot.get_updates( ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/telegram/_bot.py", line 541, in decorator result = await func(self, *args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/telegram/_bot.py", line 4177, in get_updates await self._post( File "/usr/local/lib/python3.12/site-packages/telegram/_bot.py", line 629, in _post return await self._do_post( ^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/telegram/_bot.py", line 657, in _do_post return await request.post( ^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/telegram/request/_baserequest.py", line 200, in post result = await self._request_wrapper( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/telegram/request/_baserequest.py", line 340, in _request_wrapper raise exc File "/usr/local/lib/python3.12/site-packages/telegram/request/_baserequest.py", line 330, in _request_wrapper code, payload = await self.do_request( ^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/telegram/request/_httpxrequest.py", line 300, in do_request raise NetworkError(f"httpx.{err.class.name}: {err}") from err telegram.error.NetworkError: httpx.ReadError:

What version of Home Assistant Core has the issue?

2024.5.1

What was the last working version of Home Assistant Core?

for two years

What type of installation are you running?

Home Assistant OS

Integration causing the issue

Telegram

Link to integration documentation on our website

https://www.home-assistant.io/integrations/telegram/

Diagnostics information

No response

Example YAML snippet

# Telegramm Bot
telegram_bot:
  - platform: polling
    api_key: !secret telegram_api-key
    allowed_chat_ids:
      - !secret telegram_chat-id_1

#Notifier
notify:
  - platform: telegram
    name: "John Kemmer"
    chat_id: !secret telegram_chat-id_1

Anything in the logs that might be useful for us?

No response

Additional information

No response

home-assistant[bot] commented 4 months ago

telegram documentation telegram source

u17194907425 commented 1 month ago

Same issue here. In happens randomly or at least I can't see any pattern. I'd appreciate any advice on what to try here.

jaaviercr commented 2 weeks ago

Same issue, always on line 376: Traceback (most recent call last): File "/usr/local/lib/python3.12/asyncio/events.py", line 88, in _run self._context.run(self._callback, *self._args) RuntimeError: Cannot enter into task <Task pending name='Task-29617' coro=<BaseSelectorEventLoop._accept_connection2() running at /usr/local/lib/python3.12/asyncio/selector_events.py:213>> while another task <Task pending name='Task-23860' coro=<Updater._start_polling.<locals>.polling_action_cb() running at /usr/local/lib/python3.12/site-packages/telegram/ext/_updater.py:376> cb=[_wait.<locals>._on_completion() at /usr/local/lib/python3.12/asyncio/tasks.py:534]> is being executed.

szatan81 commented 8 hours ago

Same here: Logger: telegram.ext.Updater Source: /usr/local/lib/python3.12/site-packages/telegram/ext/_updater.py:411 First occurred: September 2, 2024 at 3:12:00 AM (11 occurrences) Last logged: 3:11:37 AM

Exception happened while polling for updates. Traceback (most recent call last): File "/usr/local/lib/python3.12/site-packages/telegram/ext/_updater.py", line 742, in _network_loop_retry if not await do_action(): ^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/telegram/ext/_updater.py", line 736, in do_action return action_cb_task.result() ^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/telegram/ext/_updater.py", line 387, in polling_action_cb raise exc File "/usr/local/lib/python3.12/site-packages/telegram/ext/_updater.py", line 376, in polling_action_cb updates = await self.bot.get_updates( ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/telegram/_bot.py", line 541, in decorator result = await func(self, *args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/telegram/_bot.py", line 4177, in get_updates await self._post( File "/usr/local/lib/python3.12/site-packages/telegram/_bot.py", line 629, in _post return await self._do_post( ^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/telegram/_bot.py", line 657, in _do_post return await request.post( ^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/telegram/request/_baserequest.py", line 200, in post result = await self._request_wrapper( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/telegram/request/_baserequest.py", line 383, in _request_wrapper raise NetworkError(description or "Bad Gateway") telegram.error.NetworkError: Bad Gateway