Skip to content

Commit 167611c

Browse files
committed
Force reload of /etc/resolv.conf on WebSession init
Since #5862 we recreate the aiohttp WebSession to force reload /etc/resolv.conf. However, since aiohttp 3.12.0 (first shipped with Supervisor 2025.05.4) aiohttp no longer initializes a separate DNSResolver instance (aio-libs/aiohttp#10897) for each WebSession. This rendered #5862 essentially useless. Force a separate DNSResolver isntance to force /etc/resolv.conf reread. Note: The automatic reload of /etc/resolv.conf doesn't work in our case since /etc is stored on a overlayfs. Inotify isn't working in this case.
1 parent 1f2bf77 commit 167611c

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

supervisor/coresys.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,10 @@ async def init_websession(self) -> None:
124124

125125
resolver: aiohttp.abc.AbstractResolver
126126
try:
127-
resolver = aiohttp.AsyncResolver(loop=self.loop)
127+
# Use "unused" kwargs to force dedicated resolver instance. Otherwise
128+
# aiodns won't reload /etc/resolv.conf which we need to make our connection
129+
# check work in all cases.
130+
resolver = aiohttp.AsyncResolver(loop=self.loop, timeout=None)
128131
# pylint: disable=protected-access
129132
_LOGGER.debug(
130133
"Initializing ClientSession with AsyncResolver. Using nameservers %s",

0 commit comments

Comments
 (0)