Randomly losing internet/cloud connections on 2025.03

I upgraded to 2025.03 about two weeks ago, and since then sporadically my HASS Docker container has been losing its connection to all internet/cloud integrations.

This appears to happen about once per day, and lasts until I restart home assistant. I don’t even have to restart the docker container, and the server which also runs PiHole and my Cloudflare tunnel continue working without interruption.

Furthermore my ping entity checking 8.8.8.8 never loses connection during these outages. Other cloud integrations only regain connection after a restart.

Checking my logs does not immediately reveal a culprit, and I’m honestly lost where to go next. I know the advice is usually to disable integrations and reenable one a time, but given how intermittent the loss is it would take over a month to find the problem.

Every time there’s a disconnection I see a series of errors in the log, but its consistent what integration causes the error. I always starts like this (but not always with SamsungTV)

2025-03-22 16:59:47.467 ERROR (MainThread) [homeassistant.components.samsungtv] Unexpected error fetching samsungtv data
Traceback (most recent call last):
  File "/usr/local/lib/python3.13/asyncio/selector_events.py", line 649, in _sock_connect
    sock.connect(address)
    ~~~~~~~~~~~~^^^^^^^^^
BlockingIOError: [Errno 115] Operation in progress

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 380, in _async_refresh
    self.data = await self._async_update_data()
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/samsungtv/coordinator.py", line 53, in _async_update_data
    self.is_on = await self.bridge.async_is_on()
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/samsungtv/bridge.py", line 509, in async_is_on
    return await super().async_is_on()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/samsungtv/bridge.py", line 421, in async_is_on
    if remote := await self._async_get_remote():
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/samsungtv/bridge.py", line 455, in _async_get_remote
    return await self._async_get_remote_under_lock()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/samsungtv/bridge.py", line 610, in _async_get_remote_under_lock
    await self._remote.start_listening(self._remote_event)
  File "/usr/local/lib/python3.13/site-packages/samsungtvws/async_connection.py", line 98, in start_listening
    self.connection = await self.open()
                      ^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/samsungtvws/async_connection.py", line 67, in open
    connection = await connect(url, open_timeout=self.timeout, **connect_kwargs)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/websockets/asyncio/client.py", line 444, in __await_impl__
    self.connection = await self.create_connection()
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/websockets/asyncio/client.py", line 370, in create_connection
    _, connection = await loop.create_connection(factory, **kwargs)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/asyncio/base_events.py", line 1141, in create_connection
    sock = await self._connect_sock(
           ^^^^^^^^^^^^^^^^^^^^^^^^^
        exceptions, addrinfo, laddr_infos)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/asyncio/base_events.py", line 1044, in _connect_sock
    await self.sock_connect(sock, address)
  File "/usr/local/lib/python3.13/asyncio/selector_events.py", line 639, in sock_connect
    self._sock_connect(fut, sock, address)
    ~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/asyncio/selector_events.py", line 655, in _sock_connect
    self._ensure_fd_no_transport(fd)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^
  File "/usr/local/lib/python3.13/asyncio/selector_events.py", line 270, in _ensure_fd_no_transport
    raise RuntimeError(
        f'File descriptor {fd!r} is used by transport '
        f'{transport!r}')
RuntimeError: File descriptor 99 is used by transport <_SelectorSocketTransport fd=99 read=polling write=<idle, bufsize=0>>
2025-03-22 16:59:52.494 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved (None)
Traceback (most recent call last):
  File "/usr/local/lib/python3.13/asyncio/selector_events.py", line 649, in _sock_connect
    sock.connect(address)
    ~~~~~~~~~~~~^^^^^^^^^
BlockingIOError: [Errno 115] Operation in progress

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/config/custom_components/asusrouter/router.py", line 471, in update_all
    await self.update_clients()
  File "/config/custom_components/asusrouter/router.py", line 487, in update_clients
    api_clients = await self.bridge.async_get_clients()
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/asusrouter/bridge.py", line 332, in async_get_clients
    return await self._get_data(AsusData.CLIENTS, force=True)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/asusrouter/bridge.py", line 300, in _get_data
    raw = await self.api.async_get_data(datatype, force=force)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/asusrouter/asusrouter.py", line 703, in async_get_data
    data = await self.async_api_load(endpoint, request)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/asusrouter/asusrouter.py", line 376, in async_api_load
    status, _, content = await self.async_api_query(endpoint, request)
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/asusrouter/asusrouter.py", line 360, in async_api_query
    return await self._connection.async_query(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        endpoint, payload, request_type=request_type
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/usr/local/lib/python3.13/site-packages/asusrouter/connection.py", line 304, in async_query
    return await self._send_request(
           ^^^^^^^^^^^^^^^^^^^^^^^^^
        endpoint, payload, headers, request_type
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/usr/local/lib/python3.13/site-packages/asusrouter/connection.py", line 278, in _send_request
    raise ex
  File "/usr/local/lib/python3.13/site-packages/asusrouter/connection.py", line 242, in _send_request
    resp_status, resp_headers, resp_content = await self._make_request(
                                              ^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<4 lines>...
    )
    ^
  File "/usr/local/lib/python3.13/site-packages/asusrouter/connection.py", line 347, in _make_request
    async with self._session.request(
               ~~~~~~~~~~~~~~~~~~~~~^
        request_type.value,
        ^^^^^^^^^^^^^^^^^^^
    ...<3 lines>...
        verify_ssl=self._verify_ssl,
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ) as response:
    ^
  File "/usr/local/lib/python3.13/site-packages/aiohttp/client.py", line 1425, in __aenter__
    self._resp: _RetType = await self._coro
                           ^^^^^^^^^^^^^^^^
  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 1380, in _create_direct_connection
    transp, proto = await self._wrap_create_connection(
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<7 lines>...
    )
    ^
  File "/usr/local/lib/python3.13/site-packages/aiohttp/connector.py", line 1116, in _wrap_create_connection
    sock = await aiohappyeyeballs.start_connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<5 lines>...
    )
    ^
  File "/usr/local/lib/python3.13/site-packages/aiohappyeyeballs/impl.py", line 122, in start_connection
    raise first_exception
  File "/usr/local/lib/python3.13/site-packages/aiohappyeyeballs/impl.py", line 73, in start_connection
    sock = await _connect_sock(
           ^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )
    ^
  File "/usr/local/lib/python3.13/site-packages/aiohappyeyeballs/impl.py", line 208, in _connect_sock
    await loop.sock_connect(sock, address)
  File "/usr/local/lib/python3.13/asyncio/selector_events.py", line 639, in sock_connect
    self._sock_connect(fut, sock, address)
    ~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/asyncio/selector_events.py", line 655, in _sock_connect
    self._ensure_fd_no_transport(fd)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^
  File "/usr/local/lib/python3.13/asyncio/selector_events.py", line 270, in _ensure_fd_no_transport
    raise RuntimeError(
        f'File descriptor {fd!r} is used by transport '
        f'{transport!r}')
RuntimeError: File descriptor 99 is used by transport <_SelectorSocketTransport fd=99 read=polling write=<idle, bufsize=0>>

I have the same issue - not even the backup to nabu casa works after the connection to cloud services is lost. this happens after about a day or 1.5days. only a restart helps.

So I know that I said it would take forever to find a culprit, but I disabled the Samsung TV integration when I made this post I haven’t had the issue nearly so frequently.

I still had one loss of connection in those 4 days, but overall better?