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

async_dispatcher_send from a thread other than the event loop, which may cause Home Assistant to crash or data to corrupt. #1791

Open
lennon101 opened this issue Sep 16, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@lennon101
Copy link

The problem

Environment

System Information

version core-2024.9.1
installation_type Home Assistant Container
dev false
hassio false
docker true
user root
virtualenv false
python_version 3.12.4
os_name Linux
os_version 6.8.0-44-generic
arch x86_64
timezone Australia/Brisbane
config_dir /config
Home Assistant Community Store
GitHub API ok
GitHub Content ok
GitHub Web ok
HACS Data ok
GitHub API Calls Remaining 5000
Installed Version 2.0.1
Stage running
Available Repositories 1411
Downloaded Repositories 53
Dashboards
dashboards 10
resources 38
views 41
mode storage
Recorder
oldest_recorder_run September 5, 2024 at 10:23
current_recorder_run September 16, 2024 at 11:56
estimated_db_size 23965.99 MiB
database_engine postgresql
database_version 16.4

Steps to reproduce

The issue appears when HA is restarted or booted

DP dump

Provide Home Assistant traceback/logs

RuntimeError: Detected that custom integration 'localtuya' calls async_dispatcher_send from a thread other than the event loop, which may cause Home Assistant to crash or data to corrupt. For more information, see https://developers.home-assistant.io/docs/asyncio_thread_safety/#async_dispatcher_send at custom_components/localtuya/common.py, line 351: async_dispatcher_send(self._hass, signal, self._status). Please report it to the author of the 'localtuya' custom integration.
2024-09-16 11:56:24.024 ERROR (SyncWorker_18) [homeassistant.util.logging] Exception in _new_entity_handler when dispatching 'localtuya_entity_bfdedf96365e99c32a6a2a': ('switch.nodiee_music',)
Traceback (most recent call last):
  File "/config/custom_components/localtuya/common.py", line 263, in _new_entity_handler
    self._dispatch_status()
  File "/config/custom_components/localtuya/common.py", line 351, in _dispatch_status
    async_dispatcher_send(self._hass, signal, self._status)
  File "/usr/src/homeassistant/homeassistant/helpers/dispatcher.py", line 214, in async_dispatcher_send
    hass.verify_event_loop_thread("async_dispatcher_send")
  File "/usr/src/homeassistant/homeassistant/core.py", line 462, in verify_event_loop_thread
    frame.report_non_thread_safe_operation(what)
  File "/usr/src/homeassistant/homeassistant/helpers/frame.py", line 225, in report_non_thread_safe_operation
    report(
  File "/usr/src/homeassistant/homeassistant/helpers/frame.py", line 159, in report
    _report_integration(what, integration_frame, level, error_if_integration)
  File "/usr/src/homeassistant/homeassistant/helpers/frame.py", line 197, in _report_integration
    raise RuntimeError(
RuntimeError: Detected that custom integration 'localtuya' calls async_dispatcher_send from a thread other than the event loop, which may cause Home Assistant to crash or data to corrupt. For more information, see https://developers.home-assistant.io/docs/asyncio_thread_safety/#async_dispatcher_send at custom_components/localtuya/common.py, line 351: async_dispatcher_send(self._hass, signal, self._status). Please report it to the author of the 'localtuya' custom integration.

Additional information

@lennon101 lennon101 added the bug Something isn't working label Sep 16, 2024
@orgrazm
Copy link

orgrazm commented Sep 16, 2024

This is fixed by #1762

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