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

DNS not resolving with lastest version #96

Open
vipial1 opened this issue Jun 15, 2022 · 1 comment
Open

DNS not resolving with lastest version #96

vipial1 opened this issue Jun 15, 2022 · 1 comment

Comments

@vipial1
Copy link

vipial1 commented Jun 15, 2022

Since my HA updated the dns plugin to version 2022.04.1, most of integrations (that require Internet) are failing due to names not being resolved.

As example, HomeConnect integration logs:

Logger: homeassistant.config_entries
Source: helpers/config_entry_oauth2_flow.py:197
First occurred: 6:21:08 PM (1 occurrences)
Last logged: 6:21:08 PM

Error setting up entry Home Connect for home_connect
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/aiohttp/connector.py", line 1154, in _create_direct_connection
    hosts = await asyncio.shield(host_resolved)
  File "/usr/local/lib/python3.9/site-packages/aiohttp/connector.py", line 880, in _resolve_host
    addrs = await self._resolver.resolve(host, port, family=self._family)
  File "/usr/local/lib/python3.9/site-packages/aiohttp/resolver.py", line 33, in resolve
    infos = await self._loop.getaddrinfo(
  File "/usr/local/lib/python3.9/asyncio/base_events.py", line 861, in getaddrinfo
    return await self.run_in_executor(
  File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/local/lib/python3.9/socket.py", line 954, in getaddrinfo
    for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno -2] Name does not resolve

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

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 339, in async_setup
    result = await component.async_setup_entry(hass, self)
  File "/usr/src/homeassistant/homeassistant/components/home_connect/__init__.py", line 83, in async_setup_entry
    await update_all_devices(hass, entry)
  File "/usr/src/homeassistant/homeassistant/components/home_connect/__init__.py", line 105, in update_all_devices
    await hass.async_add_executor_job(hc_api.get_devices)
  File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/src/homeassistant/homeassistant/components/home_connect/api.py", line 70, in get_devices
    appl = self.get_appliances()
  File "/usr/local/lib/python3.9/site-packages/homeconnect/api.py", line 136, in get_appliances
    data = self.get(ENDPOINT_APPLIANCES)
  File "/usr/local/lib/python3.9/site-packages/homeconnect/api.py", line 83, in get
    res = self.request("get", endpoint)
  File "/usr/local/lib/python3.9/site-packages/homeconnect/api.py", line 77, in request
    self._oauth.token = self.refresh_tokens()
  File "/usr/src/homeassistant/homeassistant/components/home_connect/api.py", line 62, in refresh_tokens
    run_coroutine_threadsafe(
  File "/usr/local/lib/python3.9/concurrent/futures/_base.py", line 446, in result
    return self.__get_result()
  File "/usr/local/lib/python3.9/concurrent/futures/_base.py", line 391, in __get_result
    raise self._exception
  File "/usr/src/homeassistant/homeassistant/helpers/config_entry_oauth2_flow.py", line 472, in async_ensure_token_valid
    new_token = await self.implementation.async_refresh_token(self.token)
  File "/usr/src/homeassistant/homeassistant/helpers/config_entry_oauth2_flow.py", line 89, in async_refresh_token
    new_token = await self._async_refresh_token(token)
  File "/usr/src/homeassistant/homeassistant/helpers/config_entry_oauth2_flow.py", line 179, in _async_refresh_token
    new_token = await self._token_request(
  File "/usr/src/homeassistant/homeassistant/helpers/config_entry_oauth2_flow.py", line 197, in _token_request
    resp = await session.post(self.token_url, data=data)
  File "/usr/local/lib/python3.9/site-packages/aiohttp/client.py", line 535, in _request
    conn = await self._connector.connect(
  File "/usr/local/lib/python3.9/site-packages/aiohttp/connector.py", line 542, in connect
    proto = await self._create_connection(req, traces, timeout)
  File "/usr/local/lib/python3.9/site-packages/aiohttp/connector.py", line 907, in _create_connection
    _, proto = await self._create_direct_connection(req, traces, timeout)
  File "/usr/local/lib/python3.9/site-packages/aiohttp/connector.py", line 1166, in _create_direct_connection
    raise ClientConnectorError(req.connection_key, exc) from exc
aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host api.home-connect.com:443 ssl:default [Name does not resolve]

The issue is resolved simply by downgrading to previous version:
ha dns downgrade --version 2022.2.0

But after a few hours, HA detects that there is a new version available, it is upgraded to 2022.04.1 and then it starts to fail again.

This is my current dns config (everything is standard):

➜  ~ ha dns info   
fallback: false
host: 172.30.32.3
llmnr: true
locals:
- dns://8.8.8.8
- dns://1.1.1.1
mdns: true
servers: []
update_available: true
version: 2022.02.0
version_latest: 2022.04.1

DNS logs doesn't show anything prompting the error.

The only strange thing that I can observe, is that when DNS are not resolved, nslookup shows strange characters in the response, like a bad encoding (I don't have any example right now, since it is working fine now, will fail again in a few hours).

@vipial1 vipial1 changed the title DNS not resolving with last version DNS not resolving with lastest version Jun 17, 2022
@Paktosan
Copy link

I had the same issue today.
Found it suspicious that the servers list is empty.
The workaround for me was to run ha dns options --servers dns://9.9.9.9 (replace with your DNS provider of choice).
Now there is an entry in the servers list and resolving works again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants