From 4644355eff8095abd2839ccedd047e3e3c1dd57c Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Thu, 20 Jul 2023 20:00:07 -0500 Subject: [PATCH] Fix task leak on config entry unload/retry (#96981) Since the task was added to self._tasks without a `task.add_done_callback(self._tasks.remove)` each unload/retry would leak a new set of tasks --- homeassistant/config_entries.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/homeassistant/config_entries.py b/homeassistant/config_entries.py index a52b869b8300dd..7b8401ec8b5aeb 100644 --- a/homeassistant/config_entries.py +++ b/homeassistant/config_entries.py @@ -694,7 +694,7 @@ async def _async_process_on_unload(self, hass: HomeAssistant) -> None: if self._on_unload is not None: while self._on_unload: if job := self._on_unload.pop()(): - self._tasks.add(hass.async_create_task(job)) + self.async_create_task(hass, job) if not self._tasks and not self._background_tasks: return