Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Log futures that are blocking shutdown stages #88736

Merged
merged 2 commits into from
Feb 25, 2023
Merged

Log futures that are blocking shutdown stages #88736

merged 2 commits into from
Feb 25, 2023

Conversation

bdraco
Copy link
Member

@bdraco bdraco commented Feb 25, 2023

Proposed change

Log futures that are blocking shutdown stages

reported in #beta on discord https://ptb.discord.com/channels/330944238910963714/427516175237382144/1078803343394209904

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New integration (thank you!)
  • New feature (which adds functionality to an existing integration)
  • Deprecation (breaking change to happen in the future)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Additional information

  • This PR fixes or closes issue: fixes #
  • This PR is related to issue:
  • Link to documentation pull request:

Checklist

  • The code change is tested and works locally.
  • Local tests pass. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.
  • I have followed the development checklist
  • The code has been formatted using Black (black --fast homeassistant tests)
  • Tests have been added to verify that the new code works.

If user exposed functionality or configuration variables are added/changed:

If the code communicates with devices, web services, or third-party tools:

  • The manifest file has all fields filled out correctly.
    Updated and included derived files by running: python3 -m script.hassfest.
  • New or updated dependencies have been added to requirements_all.txt.
    Updated by running python3 -m script.gen_requirements_all.
  • For the updated dependencies - a link to the changelog, or at minimum a diff between library versions is added to the PR description.
  • Untested files have been added to .coveragerc.

To help with the load of incoming pull requests:

@home-assistant home-assistant bot added cla-signed core small-pr PRs with less than 30 lines. labels Feb 25, 2023
@bdraco bdraco added this to the 2023.3.0 milestone Feb 25, 2023
@bdraco
Copy link
Member Author

bdraco commented Feb 25, 2023

Testing adding it before stage 1, ... looks like we have some things that we know are safe to cancel

Feb 25 03:24:44 homeassistant homeassistant[461]: 2023-02-24 21:24:44.354 WARNING (MainThread) [homeassistant.core] Shutdown stage 0: still running: <Task pending name='Task-2929' coro=<FlowDispatcher._async_start() running at /usr/src/homeassistant/homeassistant/helpers/discovery_flow.py:93> wait_for=<_GatheringFuture pending cb=[Task.task_wakeup()]> cb=[set.remove()]>
Feb 25 03:24:44 homeassistant homeassistant[461]: 2023-02-24 21:24:44.361 WARNING (MainThread) [homeassistant.core] Shutdown stage 0: still running: <Task pending name='websocket_api.async:handle_call_service' coro=<_handle_async_response() running at /usr/src/homeassistant/homeassistant/components/websocket_api/decorators.py:26> wait_for=<Future cancelled> cb=[set.remove(), set.remove()]>
Feb 25 03:24:44 homeassistant homeassistant[461]: 2023-02-24 21:24:44.362 WARNING (MainThread) [homeassistant.core] Shutdown stage 0: still running: <Task pending name='Task-3172' coro=<NetworkWatcher.async_discover() running at /usr/src/homeassistant/homeassistant/components/dhcp/__init__.py:277> wait_for=<Future pending cb=[Task.task_wakeup()]> cb=[set.remove()]>
Feb 25 03:24:44 homeassistant homeassistant[461]: 2023-02-24 21:24:44.363 WARNING (MainThread) [homeassistant.core] Shutdown stage 0: still running: <Task pending name='Task-3435' coro=<ConfigEntriesFlowManager.async_init() running at /usr/src/homeassistant/homeassistant/config_entries.py:826> wait_for=<Task pending name='Task-3442' coro=<ConfigEntriesFlowManager._async_init() running at /usr/src/homeassistant/homeassistant/config_entries.py:854> wait_for=<Future pending cb=[Task.task_wakeup()]> cb=[Task.task_wakeup()]> cb=[set.remove()]>
Feb 25 03:24:44 homeassistant homeassistant[461]: 2023-02-24 21:24:44.364 WARNING (MainThread) [homeassistant.core] Shutdown stage 0: still running: <Task pending name='Task-3545' coro=<HomeAssistant.async_stop() running at /usr/src/homeassistant/homeassistant/core.py:721> cb=[set.remove()]>
Feb 25 03:24:44 homeassistant homeassistant[461]: 2023-02-24 21:24:44.365 WARNING (MainThread) [homeassistant.core] Shutdown stage 0: still running: <Task pending name='Task-3543' coro=<ServiceRegistry._execute_service() running at /usr/src/homeassistant/homeassistant/core.py:1809> wait_for=<Future pending cb=[Task.task_wakeup()]> cb=[set.remove(), _wait.<locals>._on_completion() at /usr/local/lib/python3.10/asyncio/tasks.py:475]>
Feb 25 03:24:44 homeassistant homeassistant[461]: 2023-02-24 21:24:44.366 WARNING (MainThread) [homeassistant.core] Shutdown stage 0: still running: <Task pending name='Task-3434' coro=<ConfigEntriesFlowManager.async_init() running at /usr/src/homeassistant/homeassistant/config_entries.py:826> wait_for=<Task pending name='Task-3441' coro=<ConfigEntriesFlowManager._async_init() running at /usr/src/homeassistant/homeassistant/config_entries.py:854> wait_for=<Future pending cb=[Task.task_wakeup()]> cb=[Task.task_wakeup()]> cb=[set.remove()]>
Feb 25 03:24:44 homeassistant homeassistant[461]: 2023-02-24 21:24:44.367 WARNING (MainThread) [homeassistant.core] Shutdown stage 0: still running: <Task pending name='unifiprotect-discovery' coro=<async_start_discovery.<locals>._async_discovery() running at /usr/src/homeassistant/homeassistant/components/unifiprotect/discovery.py:33> wait_for=<Future cancelled> cb=[set.remove(), set.remove()]>
Feb 25 03:24:44 homeassistant homeassistant[461]: 2023-02-24 21:24:44.368 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event homeassistant_stop[L]>
Feb 25 03:24:44 homeassistant homeassistant[461]: 2023-02-24 21:24:44.370 DEBUG (MainThread) [homeassistant.core] Service call was cancelled: <ServiceCall homeassistant.restart (c:01GT39KZCBX3H4H6HZT8A94HMJ)>

@bdraco bdraco marked this pull request as ready for review February 25, 2023 03:40
@bdraco bdraco requested a review from a team as a code owner February 25, 2023 03:40
homeassistant/core.py Outdated Show resolved Hide resolved
@frenck frenck merged commit 7b61d37 into dev Feb 25, 2023
@frenck frenck deleted the log_running_futures branch February 25, 2023 11:01
@github-actions github-actions bot locked and limited conversation to collaborators Feb 26, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants