Core stopped and wasn't restarted

This morning I woke up with Home Assistant being unresponsive. Luckily I could SSH in and this was the latest in the core logs:

s6-rc: info: service legacy-services: stopping
[23:53:13] INFO: Home Assistant Core finish process exit code 0
[23:53:13] INFO: Home Assistant Core service shutdown
s6-rc: info: service legacy-services successfully stopped
s6-rc: info: service legacy-cont-init: stopping
s6-rc: info: service legacy-cont-init successfully stopped
s6-rc: info: service fix-attrs: stopping
s6-rc: info: service fix-attrs successfully stopped
s6-rc: info: service s6rc-oneshot-runner: stopping
s6-rc: info: service s6rc-oneshot-runner successfully stopped

Strangely no error before this. Why would it shut down? And why wasn’t it restarted? I tried checking the supervisor logs as well, but they don’t stretch this far back for some reason.

I was able to bring the system back up with ha core start.

It happened again, and this time there was something interesting in the logs:

2024-06-25 23:30:59.487 ERROR (MainThread) [homeassistant.components.hassio.handler] Timeout on /supervisor/info request
2024-06-25 23:30:59.493 ERROR (MainThread) [homeassistant.components.hassio.handler] Timeout on /core/info request
2024-06-25 23:30:59.496 ERROR (MainThread) [homeassistant.components.hassio.handler] Timeout on /os/info request
2024-06-25 23:30:59.498 ERROR (MainThread) [homeassistant.components.hassio.handler] Timeout on /info request
2024-06-25 23:30:59.500 ERROR (MainThread) [homeassistant.components.hassio] Error fetching hassio data: Error on Supervisor API:
2024-06-25 23:31:01.915 ERROR (MainThread) [homeassistant.components.hassio.handler] Client error on /info request Cannot connect to host 172.30.32.2:80 ssl:default [Connect call failed ('172.30.32.2', 80)]
2024-06-25 23:31:01.920 ERROR (MainThread) [homeassistant.components.hassio.handler] Client error on /host/info request Cannot connect to host 172.30.32.2:80 ssl:default [Connect call failed ('172.30.32.2', 80)]
2024-06-25 23:31:01.925 ERROR (MainThread) [homeassistant.components.hassio.handler] Client error on /store request Cannot connect to host 172.30.32.2:80 ssl:default [Connect call failed ('172.30.32.2', 80)]
2024-06-25 23:31:01.929 ERROR (MainThread) [homeassistant.components.hassio.handler] Client error on /core/info request Cannot connect to host 172.30.32.2:80 ssl:default [Connect call failed ('172.30.32.2', 80)]
2024-06-25 23:31:01.933 ERROR (MainThread) [homeassistant.components.hassio.handler] Client error on /supervisor/info request Cannot connect to host 172.30.32.2:80 ssl:default [Connect call failed ('172.30.32.2', 80)]
2024-06-25 23:31:01.938 ERROR (MainThread) [homeassistant.components.hassio.handler] Client error on /os/info request Cannot connect to host 172.30.32.2:80 ssl:default [Connect call failed ('172.30.32.2', 80)]
2024-06-25 23:31:01.939 WARNING (MainThread) [homeassistant.components.hassio] Can't read Supervisor data:

Looks like it could be the same issue as mentioned here: [homeassistant.components.hassio] Can't read Supervisor data: · Issue #3301 · home-assistant/supervisor · GitHub

I am running on an older Raspberry Pi, so out of memory is definitely a possibility.

I am running into something similar…

 File "/usr/local/lib/python3.13/asyncio/base_events.py", line 550, in _check_closed
    raise RuntimeError('Event loop is closed')
RuntimeError: Event loop is closed
2025-06-28 11:53:16.360 WARNING (MainThread) [homeassistant.util.executor] Thread[SyncWorker_59] is still running at shutdown: File "/usr/local/lib/python3.13/threading.py", line 1012, in _bootstrap
    self._bootstrap_inner()
  File "/usr/local/lib/python3.13/threading.py", line 1041, in _bootstrap_inner
    self.run()
  File "/usr/local/lib/python3.13/threading.py", line 992, in run
    self._target(*self._args, **self._kwargs)
  File "/usr/local/lib/python3.13/concurrent/futures/thread.py", line 90, in _worker
    work_item = work_queue.get(block=True)
2025-06-28 11:53:16.361 ERROR (MainThread) [root] Uncaught exception
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/runner.py", line 154, in run
    return loop.run_until_complete(setup_and_run_hass(runtime_config))
           ~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/asyncio/base_events.py", line 706, in run_until_complete
    self.run_forever()
    ~~~~~~~~~~~~~~~~^^
  File "/usr/local/lib/python3.13/asyncio/base_events.py", line 677, in run_forever
    self._run_once()
    ~~~~~~~~~~~~~~^^
  File "/usr/local/lib/python3.13/asyncio/base_events.py", line 2007, in _run_once
    handle = heapq.heappop(self._scheduled)
RuntimeError: list changed size during iteration

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "/usr/src/homeassistant/homeassistant/__main__.py", line 227, in <module>
    sys.exit(main())
             ~~~~^^
  File "/usr/src/homeassistant/homeassistant/__main__.py", line 213, in main
    exit_code = runner.run(runtime_conf)
  File "/usr/src/homeassistant/homeassistant/runner.py", line 162, in run
    loop.close()
    ~~~~~~~~~~^^
  File "/usr/local/lib/python3.13/asyncio/unix_events.py", line 70, in close
    super().close()
    ~~~~~~~~~~~~~^^
  File "/usr/local/lib/python3.13/asyncio/selector_events.py", line 105, in close
    super().close()
    ~~~~~~~~~~~~~^^
  File "/usr/local/lib/python3.13/asyncio/base_events.py", line 750, in close
    executor.shutdown(wait=False)
    ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/util/executor.py", line 77, in shutdown
    self.join_threads_or_timeout()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/usr/src/homeassistant/homeassistant/util/executor.py", line 92, in join_threads_or_timeout
    remaining_threads -= join_or_interrupt_threads(
                         ~~~~~~~~~~~~~~~~~~~~~~~~~^
        remaining_threads,
        ^^^^^^^^^^^^^^^^^^
        timeout_remaining / _JOIN_ATTEMPTS,
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        attempt <= MAX_LOG_ATTEMPTS,
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/usr/src/homeassistant/homeassistant/util/executor.py", line 52, in join_or_interrupt_threads
    _log_thread_running_at_shutdown(thread.name, thread.ident)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/util/executor.py", line 30, in _log_thread_running_at_shutdown
    _LOGGER.warning(
    ~~~~~~~~~~~~~~~^
        "Thread[%s] is still running at shutdown: %s",
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        name,
        ^^^^^
        "".join(formatted_stack).strip(),
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/usr/local/lib/python3.13/logging/__init__.py", line 1531, in warning
    self._log(WARNING, msg, args, **kwargs)
    ~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/logging/__init__.py", line 1664, in _log
    self.handle(record)
    ~~~~~~~~~~~^^^^^^^^
  File "/usr/local/lib/python3.13/logging/__init__.py", line 1680, in handle
    self.callHandlers(record)
    ~~~~~~~~~~~~~~~~~^^^^^^^^
  File "/usr/local/lib/python3.13/logging/__init__.py", line 1736, in callHandlers
    hdlr.handle(record)
    ~~~~~~~~~~~^^^^^^^^
  File "/usr/local/lib/python3.13/logging/__init__.py", line 1026, in handle
    self.emit(record)
    ~~~~~~~~~^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/system_log/__init__.py", line 292, in emit
    self.hass.bus.fire(EVENT_SYSTEM_LOG, entry.to_dict())
    ~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 1501, in fire
    self._hass.loop.call_soon_threadsafe(
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
        self.async_fire_internal, event_type, event_data, origin, context
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/usr/local/lib/python3.13/asyncio/base_events.py", line 872, in call_soon_threadsafe
    self._check_closed()
    ~~~~~~~~~~~~~~~~~~^^
  File "/usr/local/lib/python3.13/asyncio/base_events.py", line 550, in _check_closed
    raise RuntimeError('Event loop is closed')
RuntimeError: Event loop is closed

I thought this was the role of the watchdog config in the supervisor to catch this and restart core ?

Hi guys,

did you ever found out what was happening?

It seems that I had a similar issue last night (also python related)
:

2025-10-05 06:41:20.938 WARNING (MainThread) [homeassistant.util.executor] Thread[SyncWorker_17] is still running at shutdown: File "/usr/local/lib/python3.13/threading.py", line 1014, in _bootstrap
    self._bootstrap_inner()
  File "/usr/local/lib/python3.13/threading.py", line 1043, in _bootstrap_inner
    self.run()
  File "/usr/local/lib/python3.13/threading.py", line 994, in run
    self._target(*self._args, **self._kwargs)
  File "/usr/local/lib/python3.13/concurrent/futures/thread.py", line 93, in _worker
    work_item.run()
  File "/usr/local/lib/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/src/homeassistant/homeassistant/components/wake_on_lan/switch.py", line 148, in update
    status = sp.call(ping_cmd, stdout=sp.DEVNULL, stderr=sp.DEVNULL)
  File "/usr/local/lib/python3.13/subprocess.py", line 397, in call
    return p.wait(timeout=timeout)
  File "/usr/local/lib/python3.13/subprocess.py", line 1280, in wait
    return self._wait(timeout=timeout)
  File "/usr/local/lib/python3.13/subprocess.py", line 2066, in _wait
    (pid, sts) = self._try_wait(0)
  File "/usr/local/lib/python3.13/subprocess.py", line 2024, in _try_wait
    (pid, sts) = os.waitpid(self.pid, wait_flags)
[04:41:38] INFO: Home Assistant Core finish process exit code 0
[04:41:38] INFO: Home Assistant Core service shutdown
s6-rc: info: service legacy-services: stopping
s6-rc: info: service legacy-services successfully stopped
s6-rc: info: service legacy-cont-init: stopping
s6-rc: info: service legacy-cont-init successfully stopped
s6-rc: info: service fix-attrs: stopping
s6-rc: info: service fix-attrs successfully stopped
s6-rc: info: service s6rc-oneshot-runner: stopping
s6-rc: info: service s6rc-oneshot-runner successfully stopped