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
70.09k stars 29.16k forks source link

Unexpected exception importing component homeassistant.components.zeroconf #115603

Closed BambamNZ closed 3 months ago

BambamNZ commented 3 months ago

The problem

Post upgrade to 2024.4.3 and a reboot of the server hosting docker, Zeroconf produced a number of errors / notifications

image

What version of Home Assistant Core has the issue?

core-2024.4.3

What was the last working version of Home Assistant Core?

core-2024.4.2

What type of installation are you running?

Home Assistant Container

Integration causing the issue

Zeroconf

Link to integration documentation on our website

No response

Diagnostics information

No response

Example YAML snippet

# Loads default set of integrations. Do not remove.
default_config:
zeroconf:
  default_interface: true
  ipv6: false

Anything in the logs that might be useful for us?

Logger: homeassistant.loader
Source: loader.py:1037
First occurred: 10:01:41 AM (8 occurrences)
Last logged: 10:01:51 AM

Unexpected exception importing component homeassistant.components.zeroconf
Unexpected exception importing component homeassistant.components.xiaomi_miio
Unexpected exception importing component custom_components.xiaomi_miot
Unexpected exception importing component homeassistant.components.cast
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/loader.py", line 1037, in _get_component
    ComponentProtocol, importlib.import_module(self.pkg_path)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/importlib/__init__.py", line 90, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 995, in exec_module
  File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
  File "/usr/src/homeassistant/homeassistant/components/zeroconf/__init__.py", line 17, in <module>
    from zeroconf import (
  File "/usr/local/lib/python3.12/site-packages/zeroconf/__init__.py", line 25, in <module>
    from ._cache import DNSCache  # noqa # import needed for backwards compat
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "src/zeroconf/_cache.py", line 1, in init zeroconf._cache
  File "src/zeroconf/_protocol/incoming.py", line 1, in init zeroconf._protocol.incoming
  File "src/zeroconf/_protocol/outgoing.py", line 1, in init zeroconf._protocol.outgoing
AttributeError: 'ModuleSpec' object has no attribute ''

Additional information

Post upgrade to 2024.4.3 everything worked, however are a reboot some hours later these errors are being reported. I've restored a backup to a test container with the same results, also deployed a brand new container with no config and the Zeroconf error is still reported although with less detail in the error log.

Don't know if this is related to mDNS ?

home-assistant[bot] commented 3 months ago

Hey there @bdraco, mind taking a look at this issue as it has been labeled with an integration (zeroconf) you are listed as a code owner for? Thanks!

Code owner commands Code owners of `zeroconf` can trigger bot actions by commenting: - `@home-assistant close` Closes the issue. - `@home-assistant rename Awesome new title` Renames the issue. - `@home-assistant reopen` Reopen the issue. - `@home-assistant unassign zeroconf` Removes the current integration label and assignees on the issue, add the integration domain after the command. - `@home-assistant add-label needs-more-information` Add a label (needs-more-information, problem in dependency, problem in custom component) to the issue. - `@home-assistant remove-label needs-more-information` Remove a label (needs-more-information, problem in dependency, problem in custom component) on the issue.

(message by CodeOwnersMention)


zeroconf documentation zeroconf source (message by IssueLinks)

TheJulianJES commented 3 months ago

Home Assistant Container

Can you confirm your container installation isn't broken?

BambamNZ commented 3 months ago

I would not say the container installation is broken, only a things aren't working e.g. Nanoleaf, Xiaomii which seems to depended on ZeroConf as a root of them not working All other integaration i.e. Tuya, Augustu, PushOver , Ring etc is working, inlcuding automations are working as expected.

As for the other containers (PiHole, Nginx, Pialert) on this instance, they are working just fine.

BambamNZ commented 3 months ago

Deployed a new docker container with version 2024.4.3 and the issue is still present, although there are fewer integration related warnings / errors. The one persistent and common one is Zeroconf. Downgraded new container to version 2024.4.2 and the issue gone away, auto-discover devices show up as expected and no further warning / errors related to zeroconf.

BambamNZ commented 3 months ago

Just tried 2024.5.0.dev202404180213 and the issue doesn't seem to be present in the Dev release. No Notifications and the zeroconf / auto-discover devices are showing up as expected.