From d0976f9a7ea32431fdedb351f56632c682ba0ed7 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Thu, 25 May 2023 16:29:19 -0500 Subject: [PATCH] Ensure setup continues to move forward if a stage times out If any stage timed out the setup of the components would be cancelled instead of moving forward fixes ``` 2023-05-25 19:21:21.696 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry Sun for sun Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/requirements.py", line 171, in async_get_integration_with_requirements await self._async_process_integration(integration, done) File "/usr/src/homeassistant/homeassistant/requirements.py", line 186, in _async_process_integration await self.async_process_requirements( File "/usr/src/homeassistant/homeassistant/requirements.py", line 248, in async_process_requirements async with self.pip_lock: File "/usr/local/lib/python3.10/asyncio/locks.py", line 14, in __aenter__ await self.acquire() File "/usr/local/lib/python3.10/asyncio/locks.py", line 114, in acquire await fut asyncio.exceptions.CancelledError During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/setup.py", line 217, in _async_setup_component processed_config = await conf_util.async_process_component_config( File "/usr/src/homeassistant/homeassistant/config.py", line 922, in async_process_component_config p_integration = await async_get_integration_with_requirements(hass, p_name) File "/usr/src/homeassistant/homeassistant/requirements.py", line 52, in async_get_integration_with_requirements return await manager.async_get_integration_with_requirements(domain) File "/usr/src/homeassistant/homeassistant/requirements.py", line 171, in async_get_integration_with_requirements await self._async_process_integration(integration, done) File "/usr/src/homeassistant/homeassistant/requirements.py", line 207, in _async_process_integration results = await asyncio.gather( asyncio.exceptions.CancelledError During handling of the above exception, another exception occurred: asyncio.exceptions.CancelledError During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/config_entries.py", line 387, in async_setup result = await component.async_setup_entry(hass, self) File "/usr/src/homeassistant/homeassistant/components/sun/__init__.py", line 101, in async_setup_entry await hass.config_entries.async_forward_entry_setups(entry, [Platform.SENSOR]) File "/usr/src/homeassistant/homeassistant/config_entries.py", line 1365, in async_forward_entry_setups await asyncio.gather( asyncio.exceptions.CancelledError 2023-05-25 19:21:21.714 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry for hacs Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/requirements.py", line 171, in async_get_integration_with_requirements await self._async_process_integration(integration, done) File "/usr/src/homeassistant/homeassistant/requirements.py", line 186, in _async_process_integration await self.async_process_requirements( File "/usr/src/homeassistant/homeassistant/requirements.py", line 248, in async_process_requirements async with self.pip_lock: File "/usr/local/lib/python3.10/asyncio/locks.py", line 14, in __aenter__ await self.acquire() File "/usr/local/lib/python3.10/asyncio/locks.py", line 114, in acquire await fut asyncio.exceptions.CancelledError During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/setup.py", line 217, in _async_setup_component processed_config = await conf_util.async_process_component_config( File "/usr/src/homeassistant/homeassistant/config.py", line 922, in async_process_component_config p_integration = await async_get_integration_with_requirements(hass, p_name) File "/usr/src/homeassistant/homeassistant/requirements.py", line 52, in async_get_integration_with_requirements return await manager.async_get_integration_with_requirements(domain) File "/usr/src/homeassistant/homeassistant/requirements.py", line 171, in async_get_integration_with_requirements await self._async_process_integration(integration, done) File "/usr/src/homeassistant/homeassistant/requirements.py", line 207, in _async_process_integration results = await asyncio.gather( asyncio.exceptions.CancelledError During handling of the above exception, another exception occurred: asyncio.exceptions.CancelledError During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/config_entries.py", line 387, in async_setup result = await component.async_setup_entry(hass, self) File "/config/custom_components/hacs/__init__.py", line 226, in async_setup_entry setup_result = await async_initialize_integration(hass=hass, config_entry=config_entry) File "/config/custom_components/hacs/__init__.py", line 212, in async_initialize_integration await async_try_startup() File "/config/custom_components/hacs/__init__.py", line 199, in async_try_startup startup_result = await async_startup() File "/config/custom_components/hacs/__init__.py", line 177, in async_startup await hass.config_entries.async_forward_entry_setups( File "/usr/src/homeassistant/homeassistant/config_entries.py", line 1365, in async_forward_entry_setups await asyncio.gather( asyncio.exceptions.CancelledError 2023-05-25 19:21:21.721 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry Socket DB565A for flux_led Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/requirements.py", line 171, in async_get_integration_with_requirements await self._async_process_integration(integration, done) File "/usr/src/homeassistant/homeassistant/requirements.py", line 186, in _async_process_integration await self.async_process_requirements( File "/usr/src/homeassistant/homeassistant/requirements.py", line 248, in async_process_requirements async with self.pip_lock: File "/usr/local/lib/python3.10/asyncio/locks.py", line 14, in __aenter__ await self.acquire() File "/usr/local/lib/python3.10/asyncio/locks.py", line 114, in acquire await fut asyncio.exceptions.CancelledError During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/setup.py", line 217, in _async_setup_component processed_config = await conf_util.async_process_component_config( File "/usr/src/homeassistant/homeassistant/config.py", line 922, in async_process_component_config p_integration = await async_get_integration_with_requirements(hass, p_name) File "/usr/src/homeassistant/homeassistant/requirements.py", line 52, in async_get_integration_with_requirements return await manager.async_get_integration_with_requirements(domain) File "/usr/src/homeassistant/homeassistant/requirements.py", line 171, in async_get_integration_with_requirements await self._async_process_integration(integration, done) File "/usr/src/homeassistant/homeassistant/requirements.py", line 207, in _async_process_integration results = await asyncio.gather( asyncio.exceptions.CancelledError During handling of the above exception, another exception occurred: asyncio.exceptions.CancelledError During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/config_entries.py", line 387, in async_setup result = await component.async_setup_entry(hass, self) File "/usr/src/homeassistant/homeassistant/components/flux_led/__init__.py", line 208, in async_setup_entry await hass.config_entries.async_forward_entry_setups(entry, platforms) File "/usr/src/homeassistant/homeassistant/config_entries.py", line 1365, in async_forward_entry_setups await asyncio.gather( asyncio.exceptions.CancelledError 2023-05-25 19:21:21.728 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry Addressable v3 5v 588EB7 for flux_led Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/requirements.py", line 171, in async_get_integration_with_requirements await self._async_process_integration(integration, done) File "/usr/src/homeassistant/homeassistant/requirements.py", line 186, in _async_process_integration await self.async_process_requirements( File "/usr/src/homeassistant/homeassistant/requirements.py", line 248, in async_process_requirements async with self.pip_lock: File "/usr/local/lib/python3.10/asyncio/locks.py", line 14, in __aenter__ await self.acquire() File "/usr/local/lib/python3.10/asyncio/locks.py", line 114, in acquire await fut asyncio.exceptions.CancelledError During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/setup.py", line 217, in _async_setup_component processed_config = await conf_util.async_process_component_config( File "/usr/src/homeassistant/homeassistant/config.py", line 922, in async_process_component_config p_integration = await async_get_integration_with_requirements(hass, p_name) File "/usr/src/homeassistant/homeassistant/requirements.py", line 52, in async_get_integration_with_requirements return await manager.async_get_integration_with_requirements(domain) File "/usr/src/homeassistant/homeassistant/requirements.py", line 171, in async_get_integration_with_requirements await self._async_process_integration(integration, done) File "/usr/src/homeassistant/homeassistant/requirements.py", line 207, in _async_process_integration results = await asyncio.gather( asyncio.exceptions.CancelledError During handling of the above exception, another exception occurred: asyncio.exceptions.CancelledError During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/config_entries.py", line 387, in async_setup result = await component.async_setup_entry(hass, self) File "/usr/src/homeassistant/homeassistant/components/flux_led/__init__.py", line 208, in async_setup_entry await hass.config_entries.async_forward_entry_setups(entry, platforms) File "/usr/src/homeassistant/homeassistant/config_entries.py", line 1365, in async_forward_entry_setups await asyncio.gather( asyncio.exceptions.CancelledError 2023-05-25 19:21:21.731 WARNING (MainThread) [homeassistant.bootstrap] Setup timed out for stage 2 - moving forward --- homeassistant/bootstrap.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/homeassistant/bootstrap.py b/homeassistant/bootstrap.py index 46bd4b5d88..672ad8b7ea 100644 --- a/homeassistant/bootstrap.py +++ b/homeassistant/bootstrap.py @@ -521,7 +521,9 @@ async def async_setup_multi_components( ) for domain in domains } - results = await asyncio.gather(*futures.values(), return_exceptions=True) + results = await asyncio.shield( + asyncio.gather(*futures.values(), return_exceptions=True) + ) for idx, domain in enumerate(futures): result = results[idx] if isinstance(result, BaseException):