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

Local mDNS lookup failed for names published by other local containers #136922

Closed
joostlek opened this issue Jan 30, 2025 · 10 comments · Fixed by #137492
Closed

Local mDNS lookup failed for names published by other local containers #136922

joostlek opened this issue Jan 30, 2025 · 10 comments · Fixed by #137492
Assignees
Milestone

Comments

@joostlek
Copy link
Member

The problem

I have my Mealie integration set up using the homeassistant.local URL (as it is running as an addon). When trying to start Mealie I get the following:

This error originated from a custom integration.

Logger: custom_components.mealie
Source: custom_components/mealie/__init__.py:52
integration: Mealie
First occurred: 15:14:02 (25 occurrences)
Last logged: 15:47:08

yes
Traceback (most recent call last):
  File "/usr/local/lib/python3.13/site-packages/aiohttp/connector.py", line 1351, in _create_direct_connection
    hosts = await self._resolve_host(host, port, traces=traces)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/aiohttp/connector.py", line 995, in _resolve_host
    return await asyncio.shield(resolved_host_task)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/aiohttp/connector.py", line 1026, in _resolve_host_with_throttle
    addrs = await self._resolver.resolve(host, port, family=self._family)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/aiohttp_asyncmdnsresolver/_impl.py", line 94, in resolve
    return await self._resolve_mdns(host, port, family)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/aiohttp_asyncmdnsresolver/_impl.py", line 116, in _resolve_mdns
    raise OSError(None, "MDNS lookup failed")
OSError: [Errno None] MDNS lookup failed

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

Traceback (most recent call last):
  File "/usr/local/lib/python3.13/site-packages/aiomealie/mealie.py", line 87, in _request
    response = await self.session.request(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^
        method, url, headers=headers, params=params, json=data
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/usr/local/lib/python3.13/site-packages/aiohttp/client.py", line 703, in _request
    conn = await self._connector.connect(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        req, traces=traces, timeout=real_timeout
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/usr/local/lib/python3.13/site-packages/aiohttp/connector.py", line 548, in connect
    proto = await self._create_connection(req, traces, timeout)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/aiohttp/connector.py", line 1056, in _create_connection
    _, proto = await self._create_direct_connection(req, traces, timeout)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/aiohttp/connector.py", line 1357, in _create_direct_connection
    raise ClientConnectorDNSError(req.connection_key, exc) from exc
aiohttp.client_exceptions.ClientConnectorDNSError: Cannot connect to host homeassistant.local:9090 ssl:default [MDNS lookup failed]

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

Traceback (most recent call last):
  File "/config/custom_components/mealie/__init__.py", line 52, in async_setup_entry
    about = await client.get_about()
            ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/aiomealie/mealie.py", line 199, in get_about
    response = await self._get("api/app/about")
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/aiomealie/mealie.py", line 139, in _get
    return await self._request(METH_GET, uri, params=params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/aiomealie/mealie.py", line 95, in _request
    raise MealieConnectionError(msg) from exception
aiomealie.exceptions.MealieConnectionError: Client connection error while connecting to Mealie

(I installed mealie as custom component as this wasn't originally logged)

What version of Home Assistant Core has the issue?

core-2025.2.0b1

What was the last working version of Home Assistant Core?

core-2025.1.4

What type of installation are you running?

Home Assistant OS

Integration causing the issue

zeroconf

Link to integration documentation on our website

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

Diagnostics information

No response

Example YAML snippet

Anything in the logs that might be useful for us?

Additional information

No response

@joostlek joostlek added this to the 2025.2.0 milestone Jan 30, 2025
@home-assistant
Copy link

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)

@bdraco
Copy link
Member

bdraco commented Jan 30, 2025

@joostlek would you please include debug logs for zeroconf from around the time the query fails ?

@bdraco bdraco changed the title Local mDNS lookup failed Local mDNS lookup failed for names published by other local containers Jan 30, 2025
@bdraco
Copy link
Member

bdraco commented Jan 30, 2025

It appears there is no response from the dns container when querying homeassistant.local. via mDNS, it only responds via normal DNS, which is why it worked before.

@davidmonro
Copy link

I'm seeing what I suspect is the same issue running under kubernetes - it appears that with this change, names ending in .local are only looked up in MDNS and not DNS; this breaks looking up k8s service names inside the cluster.

@ChromoX
Copy link

ChromoX commented Feb 5, 2025

I'm seeing what I suspect is the same issue running under kubernetes - it appears that with this change, names ending in .local are only looked up in MDNS and not DNS; this breaks looking up k8s service names inside the cluster.

I'm seeing the same thing. Disabling zeroconf in the configuration.yaml doesn't seem to fix anything.

@bdraco
Copy link
Member

bdraco commented Feb 5, 2025

We are only doing mDNS queries for .local domains now over aiohttp. Its a bit unexpected that .local domains are published via standard DNS. However this issue is about communication of mDNS traffic between containers so its not the place to discuss that change.

@davidmonro
Copy link

We are only doing mDNS queries for .local domains now over aiohttp. Its a bit unexpected that .local domains are published via standard DNS. However this issue is about communication of mDNS traffic between containers so its not the place to discuss that change.

Where should we discuss it then?

@bdraco
Copy link
Member

bdraco commented Feb 5, 2025

We are only doing mDNS queries for .local domains now over aiohttp. Its a bit unexpected that .local domains are published via standard DNS. However this issue is about communication of mDNS traffic between containers so its not the place to discuss that change.

Where should we discuss it then?

Please make a new issue to discuss your specific use case.

@ChromoX
Copy link

ChromoX commented Feb 5, 2025

I've made an issue specifically for the Kubernetes/Container .local (m)DNS resolution issues. #137478

@davidmonro
Copy link

raised an issue here: #137479

bdraco added a commit that referenced this issue Feb 6, 2025
changelog: aio-libs/aiohttp-asyncmdnsresolver@v0.0.3...v0.1.0

Switches to the new AsyncDualMDNSResolver class to which
tries via mDNS and DNS for .local domains since we have
so many different user DNS configurations to support

fixes #137479
fixes #136922
@balloob balloob closed this as completed in d1b2231 Feb 6, 2025
frenck pushed a commit that referenced this issue Feb 7, 2025
changelog: aio-libs/aiohttp-asyncmdnsresolver@v0.0.3...v0.1.0

Switches to the new AsyncDualMDNSResolver class to which
tries via mDNS and DNS for .local domains since we have
so many different user DNS configurations to support

fixes #137479
fixes #136922
frenck added a commit that referenced this issue Feb 7, 2025
* Fix hassio test using wrong fixture (#137516)

* Change Electric Kiwi authentication (#135231)

Co-authored-by: Joostlek <[email protected]>

* Update govee-ble to 0.42.1 (#137371)

* Bump holidays to 0.66 (#137449)

* Bump aiohttp-asyncmdnsresolver to 0.1.0 (#137492)

changelog: aio-libs/aiohttp-asyncmdnsresolver@v0.0.3...v0.1.0

Switches to the new AsyncDualMDNSResolver class to which
tries via mDNS and DNS for .local domains since we have
so many different user DNS configurations to support

fixes #137479
fixes #136922

* Bump aiohttp to 3.11.12 (#137494)

changelog: aio-libs/aiohttp@v3.11.11...v3.11.12

* Bump govee-ble to 0.43.0 to fix compat with new H5179 firmware (#137508)

changelog: Bluetooth-Devices/govee-ble@v0.42.1...v0.43.0

fixes #136969

* Bump habiticalib to v0.3.5 (#137510)

* Fix Mill issue, where no sensors were shown (#137521)

Fix mill issue #137477

Signed-off-by: Daniel Hjelseth Høyer <[email protected]>

* Don't overwrite setup state in async_set_domains_to_be_loaded (#137547)

* Use separate metadata files for onedrive (#137549)

* Fix sending polls to Telegram threads (#137553)

Fix sending poll to Telegram thread

* Skip building wheels for electrickiwi-api (#137556)

* Add excluded domains to broadcast intent (#137566)

* Revert "Add `PaddleSwitchPico` (Pico Paddle Remote) device trigger to Lutron Caseta" (#137571)

* Fix Overseerr webhook configuration JSON (#137572)

Co-authored-by: Lars Jouon <[email protected]>

* Do not rely on pyserial for port scanning with the CM5 + ZHA (#137585)

Do not rely on pyserial for port scanning with the CM5

* Bump eheimdigital to 1.0.6 (#137587)

* Bump pyfireservicerota to 0.0.46 (#137589)

* Bump reolink-aio to 0.11.10 (#137591)

* Allow to omit the payload attribute to MQTT publish action to allow an empty payload to be sent by default (#137595)

Allow to omit the payload attribute to MQTT publish actionto allow an empty payload to be sent by default

* Handle previously migrated HEOS device identifier (#137596)

* Bump `aioshelly` to version `12.4.1` (#137598)

* Bump aioshelly to 12.4.0

* Bump to 12.4.1

* Bump electrickiwi-api  to 0.9.13 (#137601)

* bump ek api version to fix deps

* Revert "Skip building wheels for electrickiwi-api (#137556)"

This reverts commit 5f6068e.

---------

Co-authored-by: Marc Mueller <[email protected]>

* Bump ZHA to 0.0.48 (#137610)

* Bump Electrickiwi-api to 0.9.14 (#137614)

* bump library to fix bug with post

* rebuild

* Update google-nest-sdm to 7.1.3 (#137625)

* Update google-nest-sdm to 7.1.2

* Bump nest to 7.1.3

* Don't use the current temperature from Shelly BLU TRV as a state for External Temperature number entity (#137658)

Introduce RpcBluTrvExtTempNumber for External Temperature entity

* Fix LG webOS TV turn off when device is already off (#137675)

* Bump version to 2025.2.1

---------

Signed-off-by: Daniel Hjelseth Høyer <[email protected]>
Co-authored-by: Erik Montnemery <[email protected]>
Co-authored-by: Michael Arthur <[email protected]>
Co-authored-by: Joostlek <[email protected]>
Co-authored-by: Marc Mueller <[email protected]>
Co-authored-by: G Johansson <[email protected]>
Co-authored-by: J. Nick Koston <[email protected]>
Co-authored-by: Manu <[email protected]>
Co-authored-by: Daniel Hjelseth Høyer <[email protected]>
Co-authored-by: Josef Zweck <[email protected]>
Co-authored-by: Jasper Wiegratz <[email protected]>
Co-authored-by: Michael Hansen <[email protected]>
Co-authored-by: Dennis Effing <[email protected]>
Co-authored-by: Lars Jouon <[email protected]>
Co-authored-by: puddly <[email protected]>
Co-authored-by: Sid <[email protected]>
Co-authored-by: Ron <[email protected]>
Co-authored-by: starkillerOG <[email protected]>
Co-authored-by: Jan Bouwhuis <[email protected]>
Co-authored-by: Andrew Sayre <[email protected]>
Co-authored-by: Maciej Bieniek <[email protected]>
Co-authored-by: TheJulianJES <[email protected]>
Co-authored-by: Allen Porter <[email protected]>
Co-authored-by: Shay Levy <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants