home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
73.4k stars 30.65k forks source link

Setup timed out for bootstrap waiting on Bluesound #123380

Closed taakberg closed 2 months ago

taakberg commented 2 months ago

The problem

I just updated to Home Assistant Core 2024.8.0, which makes the Bluesound integration available trough the UI. I previously had bluesound configured via YAML, so that configuration was imported to the UI.

After updating, I noticed Home Assistant taking a long time to start up completely. When checking the logs, I noticed that Home Assistant seems to be waiting on a Bluesound task that seems to be running too long.

When restarting Home Assistant, it now takes around 5 minutes longer then usual.

What version of Home Assistant Core has the issue?

core-2024.8.0

What was the last working version of Home Assistant Core?

core-2024.7.0

What type of installation are you running?

Home Assistant Container

Integration causing the issue

Bluesound

Link to integration documentation on our website

https://www.home-assistant.io/integrations/bluesound

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

2024-08-08 15:28:27.821 WARNING (MainThread) [homeassistant.bootstrap] Setup timed out for bootstrap waiting on {<Task pending name='Task-98' coro=<BluesoundPlayer._start_poll_command() running at /usr/src/homeassistant/homeassistant/components/bluesound/media_player.py:317> wait_for=<Future pending cb=[Task.task_wakeup()]> cb=[set.remove()]>} - moving forward

2024-08-08 15:28:42.848 WARNING (MainThread) [homeassistant.core] Something is blocking Home Assistant from wrapping up the start up phase. We're going to continue anyway. Please report the following info at https://github.com/home-assistant/core/issues: unifiprotect.select, wake_on_lan, config, ssdp, bluesound.media_player, ics_calendar.calendar, pushover, google_translate.tts, mqtt.sensor, dlna_dmr, image_upload, blueprint, bluesound, mqtt.event, template.sensor, binary_sensor, unifi.update, unifiprotect.binary_sensor, network, mqtt.switch, shelly.sensor, default_config, auto_backup.sensor, cloud.tts, assist_pipeline, zwave_js.button, system_health, zwave_js.sensor, unifi.button, cover, shelly.valve, mobile_app, unifiprotect.camera, homeassistant, unifiprotect.number, input_select, home_connect_alt, switch, shelly.binary_sensor, cast, synology_dsm.binary_sensor, home_connect_alt.binary_sensor, button, synology_dsm.button, plex.media_player, analytics, hacs, person, radio_browser, zwave_js.light, diagnostics, logbook, unifi.device_tracker, shelly, fan, api, home_connect_alt.select, mobile_app.binary_sensor, script, cloud, unifiprotect.media_player, zeroconf, auth, surepetcare, input_button, buienradar.sensor, derivative, notify, calendar, trace, samsungtv.remote, file_upload, wake_word, valve, unifiprotect.button, unifi.sensor, device_automation, nest, samsungtv, home_connect_alt.number, home_connect_alt.time, home_connect_alt.switch, zwave_js.binary_sensor, device_tracker, template, shelly.climate, scene, intent, synology_dsm, remote, stream, light, zwave_js.select, input_text, timer, climate, synology_dsm.sensor, zwave_js.cover, synology_dsm.switch, media_source, unifi.switch, sensor, plex.sensor, plex, auto_backup, tag, unifiprotect.light, home_connect_alt.button, derivative.sensor, logger, buienradar.weather, history, unifiprotect.event, mqtt.fan, automation, hardware, synology_dsm.camera, mqtt.light, search, sun, zwave_js, template.binary_sensor, media_extractor, energy, cast.media_player, zwave_js.event, weather, input_number, synology_dsm.update, ffmpeg, sun.sensor, mobile_app.sensor, dhcp, homeassistant_alerts, lock, tod.binary_sensor, home_connect_alt.sensor, zwave_js.number, stt, homeassistant.scene, pushover.notify, shelly.switch, input_datetime, usb, zone, unifiprotect, mobile_app.device_tracker, mobile_app.notify, surepetcare.binary_sensor, application_credentials, http, conversation, shelly.text, update, tts, schedule, my, shelly.cover, unifi, zwave_js.switch, map, counter, nest.camera, shelly.update, surepetcare.sensor, co2signal.sensor, shelly.number, energy.sensor, plex.button, dlna_dms, nest.sensor, onboarding, wake_on_lan.switch, frontend, omnik_inverter.binary_sensor, media_player, unifiprotect.sensor, dlna_dmr.media_player, nest.climate, tod, persistent_notification, buienradar, shelly.event, universal.media_player, websocket_api, plex.update, backup, samsungtv.media_player, text, omnik_inverter.sensor, mqtt.cover, lovelace, unifiprotect.switch, ipp, ics_calendar, repairs, time, shelly.select, number, shelly.button, hacs.sensor, shelly.light, unifiprotect.text, unifi.image, zwave_js.update, webhook, omnik_inverter, co2signal, bluetooth, image, buienradar.camera, system_log, camera, event, surepetcare.lock, unifiprotect.lock, select, recorder, mqtt, input_boolean The system is waiting for tasks: {<Task pending name='Task-98' coro=<BluesoundPlayer._start_poll_command() running at /usr/src/homeassistant/homeassistant/components/bluesound/media_player.py:317> wait_for=<Future pending cb=[Task.task_wakeup()]> cb=[set.remove()]>}

2024-08-08 15:19:17.913 WARNING (Recorder) [homeassistant.components.recorder.migration] The database is about to upgrade from schema version 43 to 44
2024-08-08 15:19:17.926 WARNING (Recorder) [homeassistant.components.recorder.migration] Upgrade to version 44 done

Later, when restarting:

2024-08-08 15:39:48.774 WARNING (MainThread) [homeassistant.core] Task <Task pending name='Task-98' coro=<BluesoundPlayer._start_poll_command() running at /usr/src/homeassistant/homeassistant/components/bluesound/media_player.py:317> wait_for=<Future pending cb=[Task.task_wakeup()]> cb=[set.remove()]> was still running after final writes shutdown stage; Integrations should cancel non-critical tasks when receiving the stop event to prevent delaying shutdown
2024-08-08 15:39:48.776 DEBUG (MainThread) [homeassistant.components.bluesound.media_player] Stopping the polling of node None:11000
[15:39:51] INFO: Home Assistant Core finish process exit code 100
2024-08-08 15:45:12.502 WARNING (MainThread) [homeassistant.bootstrap] Setup timed out for bootstrap waiting on {<Task pending name='Task-1537' coro=<BluesoundPlayer._start_poll_command() running at /usr/src/homeassistant/homeassistant/components/bluesound/media_player.py:317> wait_for=<Future pending cb=[Task.task_wakeup()]> cb=[set.remove()]>} - moving forward

Additional information

No response

home-assistant[bot] commented 2 months ago

Hey there @thrawnarn, @louischrist, mind taking a look at this issue as it has been labeled with an integration (bluesound) you are listed as a code owner for? Thanks!

Code owner commands Code owners of `bluesound` can trigger bot actions by commenting: - `@home-assistant close` Closes the issue. - `@home-assistant rename Awesome new title` Renames the issue. - `@home-assistant reopen` Reopen the issue. - `@home-assistant unassign bluesound` Removes the current integration label and assignees on the issue, add the integration domain after the command. - `@home-assistant add-label needs-more-information` Add a label (needs-more-information, problem in dependency, problem in custom component) to the issue. - `@home-assistant remove-label needs-more-information` Remove a label (needs-more-information, problem in dependency, problem in custom component) on the issue.

(message by CodeOwnersMention)


bluesound documentation bluesound source (message by IssueLinks)

LouisChrist commented 2 months ago

This use of async_create_task might be the reason:

async def async_added_to_hass(self) -> None:
    """Start the polling task."""
    await super().async_added_to_hass()

    self._polling_task = self.hass.async_create_task(self._start_poll_command())

Using async_create_background_task seems to solve the problem.