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

ERROR (zeroconf-ServiceBrowser-_yandexio._tcp-127) [homeassistant] Error doing job: Task was destroyed but it is pending! #503

Open
to4ko opened this issue May 3, 2024 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@to4ko
Copy link

to4ko commented May 3, 2024

ХА - 2024.5.0
Интеграция - 3.15.1
сыпет каждые 3 минуты по 7 ошибок, ровно по количеству станций в локальной сети

to reproduce follow home-assistant/core#115071 (comment)

2024-05-03 09:09:20.843 ERROR (zeroconf-ServiceBrowser-_yandexio._tcp-127) [homeassistant] Error doing job: Task was destroyed but it is pending!:   File "/usr/local/lib/python3.12/threading.py", line 1030, in _bootstrap
    self._bootstrap_inner()
  File "/usr/local/lib/python3.12/threading.py", line 1073, in _bootstrap_inner
    self.run()
  File "/config/custom_components/yandex_station/core/yandex_glagol.py", line 298, in _zeroconf_handler
    self.loop.create_task(coro)
  File "/usr/local/lib/python3.12/asyncio/base_events.py", line 457, in create_task
    task = tasks.Task(coro, loop=self, name=name, context=context)
2024-05-03 09:09:20.844 WARNING (zeroconf-ServiceBrowser-_yandexio._tcp-127) [py.warnings] /usr/local/lib/python3.12/threading.py:1073: RuntimeWarning: coroutine '_init_local_discovery.<locals>.found_local_speaker' was never awaited
  self.run()
2024-05-03 09:09:21.584 ERROR (zeroconf-ServiceBrowser-_yandexio._tcp-127) [homeassistant] Error doing job: Task was destroyed but it is pending!:   File "/usr/local/lib/python3.12/threading.py", line 1030, in _bootstrap
    self._bootstrap_inner()
  File "/usr/local/lib/python3.12/threading.py", line 1073, in _bootstrap_inner
    self.run()
  File "/config/custom_components/yandex_station/core/yandex_glagol.py", line 298, in _zeroconf_handler
    self.loop.create_task(coro)
  File "/usr/local/lib/python3.12/asyncio/base_events.py", line 457, in create_task
    task = tasks.Task(coro, loop=self, name=name, context=context)
2024-05-03 09:09:21.584 WARNING (zeroconf-ServiceBrowser-_yandexio._tcp-127) [py.warnings] /usr/local/lib/python3.12/threading.py:1073: RuntimeWarning: coroutine '_init_local_discovery.<locals>.found_local_speaker' was never awaited
  self.run()
2024-05-03 09:09:21.586 ERROR (zeroconf-ServiceBrowser-_yandexio._tcp-127) [homeassistant] Error doing job: Task was destroyed but it is pending!:   File "/usr/local/lib/python3.12/threading.py", line 1030, in _bootstrap
    self._bootstrap_inner()
  File "/usr/local/lib/python3.12/threading.py", line 1073, in _bootstrap_inner
    self.run()
  File "/config/custom_components/yandex_station/core/yandex_glagol.py", line 298, in _zeroconf_handler
    self.loop.create_task(coro)
  File "/usr/local/lib/python3.12/asyncio/base_events.py", line 457, in create_task
    task = tasks.Task(coro, loop=self, name=name, context=context)
2024-05-03 09:09:22.037 ERROR (zeroconf-ServiceBrowser-_yandexio._tcp-127) [homeassistant] Error doing job: Task was destroyed but it is pending!:   File "/usr/local/lib/python3.12/threading.py", line 1030, in _bootstrap
    self._bootstrap_inner()
  File "/usr/local/lib/python3.12/threading.py", line 1073, in _bootstrap_inner
    self.run()
  File "/config/custom_components/yandex_station/core/yandex_glagol.py", line 298, in _zeroconf_handler
    self.loop.create_task(coro)
  File "/usr/local/lib/python3.12/asyncio/base_events.py", line 457, in create_task
    task = tasks.Task(coro, loop=self, name=name, context=context)
2024-05-03 09:09:22.377 ERROR (zeroconf-ServiceBrowser-_yandexio._tcp-127) [homeassistant] Error doing job: Task was destroyed but it is pending!:   File "/usr/local/lib/python3.12/threading.py", line 1030, in _bootstrap
    self._bootstrap_inner()
  File "/usr/local/lib/python3.12/threading.py", line 1073, in _bootstrap_inner
    self.run()
  File "/config/custom_components/yandex_station/core/yandex_glagol.py", line 298, in _zeroconf_handler
    self.loop.create_task(coro)
  File "/usr/local/lib/python3.12/asyncio/base_events.py", line 457, in create_task
    task = tasks.Task(coro, loop=self, name=name, context=context)
2024-05-03 09:09:23.001 ERROR (zeroconf-ServiceBrowser-_yandexio._tcp-127) [homeassistant] Error doing job: Task was destroyed but it is pending!:   File "/usr/local/lib/python3.12/threading.py", line 1030, in _bootstrap
    self._bootstrap_inner()
  File "/usr/local/lib/python3.12/threading.py", line 1073, in _bootstrap_inner
    self.run()
  File "/config/custom_components/yandex_station/core/yandex_glagol.py", line 298, in _zeroconf_handler
    self.loop.create_task(coro)
  File "/usr/local/lib/python3.12/asyncio/base_events.py", line 457, in create_task
    task = tasks.Task(coro, loop=self, name=name, context=context)
2024-05-03 09:09:25.011 ERROR (zeroconf-ServiceBrowser-_yandexio._tcp-127) [homeassistant] Error doing job: Task was destroyed but it is pending!:   File "/usr/local/lib/python3.12/threading.py", line 1030, in _bootstrap
    self._bootstrap_inner()
  File "/usr/local/lib/python3.12/threading.py", line 1073, in _bootstrap_inner
    self.run()
  File "/config/custom_components/yandex_station/core/yandex_glagol.py", line 298, in _zeroconf_handler
    self.loop.create_task(coro)
  File "/usr/local/lib/python3.12/asyncio/base_events.py", line 457, in create_task
    task = tasks.Task(coro, loop=self, name=name, context=context)
@to4ko
Copy link
Author

to4ko commented May 3, 2024

а на втором инстансе (там ХА 2024.4.4) сразу RuntimeError: Non-thread-safe operation invoked on an event loop other than the current one

и таких блоков (как приведено ниже) 7 штук, как и Я станций в локалке


2024-05-03 09:51:26.210 ERROR (zeroconf-ServiceBrowser-_yandexio._tcp-128) [homeassistant] Error doing job: Task was destroyed but it is pending!:   File "/usr/local/lib/python3.12/threading.py", line 1030, in _bootstrap
    self._bootstrap_inner()
  File "/usr/local/lib/python3.12/threading.py", line 1073, in _bootstrap_inner
    self.run()
  File "/config/custom_components/yandex_station/core/yandex_glagol.py", line 298, in _zeroconf_handler
    self.loop.create_task(coro)
  File "/usr/local/lib/python3.12/asyncio/base_events.py", line 457, in create_task
    task = tasks.Task(coro, loop=self, name=name, context=context)
2024-05-03 09:51:26.211 ERROR (zeroconf-ServiceBrowser-_yandexio._tcp-128) [asyncio] Unhandled error in exception handler
context: {'message': 'Task was destroyed but it is pending!', 'task': .found_local_speaker() running at /config/custom_components/yandex_station/__init__.py:198> created at /usr/local/lib/python3.12/asyncio/base_events.py:457>, 'source_traceback': [, , , ]}
Traceback (most recent call last):
  File "/usr/local/lib/python3.12/asyncio/base_events.py", line 1869, in call_exception_handler
    ctx.run(self._exception_handler, self, context)
  File "/usr/src/homeassistant/homeassistant/runner.py", line 138, in _async_loop_exception_handler
    logger.error(
  File "/usr/local/lib/python3.12/logging/__init__.py", line 1568, in error
  File "/usr/local/lib/python3.12/logging/__init__.py", line 1684, in _log
    self.handle(record)
  File "/usr/local/lib/python3.12/logging/__init__.py", line 1700, in handle
    self.callHandlers(record)
  File "/usr/local/lib/python3.12/logging/__init__.py", line 1762, in callHandlers
    hdlr.handle(record)
  File "/usr/local/lib/python3.12/logging/__init__.py", line 1028, in handle
    self.emit(record)
  File "/config/custom_components/hass_diagnostics/sensor.py", line 85, in emit
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1181, in _async_write_ha_state
    hass.states.async_set(
  File "/usr/src/homeassistant/homeassistant/core.py", line 2181, in async_set
    self._bus._async_fire(  # pylint: disable=protected-access
  File "/usr/src/homeassistant/homeassistant/core.py", line 1459, in _async_fire
    self._hass.async_add_hass_job(job, event)
  File "/usr/src/homeassistant/homeassistant/core.py", line 690, in async_add_hass_job
    self.loop.call_soon(hassjob.target, *args)
  File "/usr/local/lib/python3.12/asyncio/base_events.py", line 795, in call_soon
    self._check_thread()
  File "/usr/local/lib/python3.12/asyncio/base_events.py", line 832, in _check_thread
    raise RuntimeError(
RuntimeError: Non-thread-safe operation invoked on an event loop other than the current one
2024-05-03 09:51:26.214 ERROR (zeroconf-ServiceBrowser-_yandexio._tcp-128) [asyncio] Exception in default exception handler while handling an unexpected error in custom exception handler
Traceback (most recent call last):
  File "/usr/local/lib/python3.12/asyncio/base_events.py", line 1869, in call_exception_handler
    ctx.run(self._exception_handler, self, context)
  File "/usr/src/homeassistant/homeassistant/runner.py", line 138, in _async_loop_exception_handler
    logger.error(
  File "/usr/local/lib/python3.12/logging/__init__.py", line 1568, in error
  File "/usr/local/lib/python3.12/logging/__init__.py", line 1684, in _log
    self.handle(record)
  File "/usr/local/lib/python3.12/logging/__init__.py", line 1700, in handle
    self.callHandlers(record)
  File "/usr/local/lib/python3.12/logging/__init__.py", line 1762, in callHandlers
    hdlr.handle(record)
  File "/usr/local/lib/python3.12/logging/__init__.py", line 1028, in handle
    self.emit(record)
  File "/config/custom_components/hass_diagnostics/sensor.py", line 85, in emit
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1181, in _async_write_ha_state
    hass.states.async_set(
  File "/usr/src/homeassistant/homeassistant/core.py", line 2181, in async_set
    self._bus._async_fire(  # pylint: disable=protected-access
  File "/usr/src/homeassistant/homeassistant/core.py", line 1459, in _async_fire
    self._hass.async_add_hass_job(job, event)
  File "/usr/src/homeassistant/homeassistant/core.py", line 690, in async_add_hass_job
    self.loop.call_soon(hassjob.target, *args)
  File "/usr/local/lib/python3.12/asyncio/base_events.py", line 795, in call_soon
    self._check_thread()
  File "/usr/local/lib/python3.12/asyncio/base_events.py", line 832, in _check_thread
    raise RuntimeError(
RuntimeError: Non-thread-safe operation invoked on an event loop other than the current one
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "/usr/local/lib/python3.12/asyncio/base_events.py", line 1878, in call_exception_handler
    self.default_exception_handler({
  File "/usr/local/lib/python3.12/asyncio/base_events.py", line 1819, in default_exception_handler
    logger.error('\n'.join(log_lines), exc_info=exc_info)
  File "/usr/local/lib/python3.12/logging/__init__.py", line 1568, in error
  File "/usr/local/lib/python3.12/logging/__init__.py", line 1684, in _log
    self.handle(record)
  File "/usr/local/lib/python3.12/logging/__init__.py", line 1700, in handle
    self.callHandlers(record)
  File "/usr/local/lib/python3.12/logging/__init__.py", line 1762, in callHandlers
    hdlr.handle(record)
  File "/usr/local/lib/python3.12/logging/__init__.py", line 1028, in handle
    self.emit(record)
  File "/config/custom_components/hass_diagnostics/sensor.py", line 85, in emit
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1181, in _async_write_ha_state
    hass.states.async_set(
  File "/usr/src/homeassistant/homeassistant/core.py", line 2181, in async_set
    self._bus._async_fire(  # pylint: disable=protected-access
  File "/usr/src/homeassistant/homeassistant/core.py", line 1459, in _async_fire
    self._hass.async_add_hass_job(job, event)
  File "/usr/src/homeassistant/homeassistant/core.py", line 690, in async_add_hass_job
    self.loop.call_soon(hassjob.target, *args)
  File "/usr/local/lib/python3.12/asyncio/base_events.py", line 795, in call_soon
    self._check_thread()
  File "/usr/local/lib/python3.12/asyncio/base_events.py", line 832, in _check_thread
    raise RuntimeError(
RuntimeError: Non-thread-safe operation invoked on an event loop other than the current one

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

2 participants