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

Stop the Home Assistant Core container by default #101105

Merged
merged 1 commit into from
Sep 30, 2023

Conversation

agners
Copy link
Member

@agners agners commented Sep 29, 2023

Breaking change

Proposed change

When Home Assistant Core crashes (e.g. due to SIGILL, signal number 4 as caused by #101027) the container should exit. This makes sure that the exit code can be read by container orchestration software such as the Supervisor and act upon.

With this, the Supervisor properly rolls back Home Assistant Core to the previously installed version.

See also home-assistant/supervisor#4590 (comment).

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
  • I have followed the perfect PR recommendations
  • 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:

When Home Assistant Core crashes (e.g. due to SIGILL, signal number 4
as caused by #101027) the container should exit. This makes sure that
the exit code can be read by container orchistration software such as
the Supervisor and act upon.

With this, the Supervisor properly rolls back Home Assistant Core to the
previously installed version.

See also home-assistant/supervisor#4590 (comment).
@agners agners requested a review from pvizeli September 29, 2023 11:02
@home-assistant home-assistant bot added bugfix cla-signed small-pr PRs with less than 30 lines. labels Sep 29, 2023
@agners
Copy link
Member Author

agners commented Sep 29, 2023

I've tested Core stop/start and restart with Supervisor. What I've noticed is that with restart the Core does not exit with exit code 100 (RESTART_EXIT_CODE). But that might be intended behavior on Supervisor, IIRC?

Logs when triggering a restart:

Sep 29 11:01:29 homeassistant hassio_supervisor[427]: 23-09-29 13:01:29 INFO (SyncWorker_3) [supervisor.docker.manager] Restarting homeassistant
Sep 29 11:01:29 homeassistant homeassistant[427]: s6-rc: info: service legacy-services: stopping
...
Sep 29 11:01:30 homeassistant homeassistant[427]: [11:01:30] INFO: Home Assistant Core finish process exit code 0
Sep 29 11:01:30 homeassistant homeassistant[427]: [11:01:30] INFO: Home Assistant Core service shutdown
Sep 29 11:01:30 homeassistant homeassistant[427]: [11:01:30] INFO: Home Assistant Core service shutdown
Sep 29 11:01:30 homeassistant homeassistant[427]: s6-rc: info: service legacy-services successfully stopped
Sep 29 11:01:30 homeassistant homeassistant[427]: s6-rc: info: service legacy-cont-init: stopping
Sep 29 11:01:30 homeassistant homeassistant[427]: s6-rc: info: service legacy-cont-init successfully stopped
Sep 29 11:01:30 homeassistant homeassistant[427]: s6-rc: info: service fix-attrs: stopping
Sep 29 11:01:30 homeassistant homeassistant[427]: s6-rc: info: service fix-attrs successfully stopped
Sep 29 11:01:30 homeassistant homeassistant[427]: s6-rc: info: service s6rc-oneshot-runner: stopping
Sep 29 11:01:30 homeassistant homeassistant[427]: s6-rc: info: service s6rc-oneshot-runner successfully stopped
Sep 29 11:01:34 homeassistant hassio_supervisor[427]: 23-09-29 13:01:34 INFO (MainThread) [supervisor.homeassistant.core] Wait until Home Assistant is ready
Sep 29 11:01:34 homeassistant homeassistant[427]: s6-rc: info: service s6rc-oneshot-runner: starting
Sep 29 11:01:34 homeassistant homeassistant[427]: s6-rc: info: service s6rc-oneshot-runner successfully started
Sep 29 11:01:34 homeassistant homeassistant[427]: s6-rc: info: service fix-attrs: starting
Sep 29 11:01:34 homeassistant homeassistant[427]: s6-rc: info: service fix-attrs successfully started
Sep 29 11:01:34 homeassistant homeassistant[427]: s6-rc: info: service legacy-cont-init: starting
Sep 29 11:01:34 homeassistant homeassistant[427]: s6-rc: info: service legacy-cont-init successfully started
Sep 29 11:01:34 homeassistant homeassistant[427]: s6-rc: info: service legacy-services: starting
Sep 29 11:01:34 homeassistant homeassistant[427]: services-up: info: copying legacy longrun home-assistant (no readiness notification)
Sep 29 11:01:34 homeassistant homeassistant[427]: s6-rc: info: service legacy-services successfully started
Sep 29 11:01:36 homeassistant hassio_supervisor[427]: 23-09-29 13:01:36 INFO (MainThread) [supervisor.resolution.evaluate] Starting system evaluation with state running
Sep 29 11:01:36 homeassistant hassio_supervisor[427]: 23-09-29 13:01:36 INFO (MainThread) [supervisor.resolution.evaluate] System evaluation complete
Sep 29 11:01:36 homeassistant hassio_supervisor[427]: 23-09-29 13:01:36 INFO (MainThread) [supervisor.updater] Fetching update data from https://version.home-assistant.io/stable.json
Sep 29 11:01:36 homeassistant hassio_supervisor[427]: 23-09-29 13:01:36 INFO (MainThread) [supervisor.store.git] Update add-on https://github.com/esphome/home-assistant-addon repository
Sep 29 11:01:36 homeassistant hassio_supervisor[427]: 23-09-29 13:01:36 INFO (MainThread) [supervisor.store.git] Update add-on https://github.com/home-assistant/addons repository
Sep 29 11:01:36 homeassistant hassio_supervisor[427]: 23-09-29 13:01:36 INFO (MainThread) [supervisor.store.git] Update add-on https://github.com/hassio-addons/repository repository
Sep 29 11:01:38 homeassistant hassio_supervisor[427]: 23-09-29 13:01:38 INFO (MainThread) [supervisor.store] Loading add-ons from store: 72 all - 0 new - 0 remove
Sep 29 11:01:38 homeassistant hassio_supervisor[427]: 23-09-29 13:01:38 INFO (MainThread) [supervisor.store] Loading add-ons from store: 72 all - 0 new - 0 remove
Sep 29 11:01:44 homeassistant hassio_supervisor[427]: 23-09-29 13:01:44 INFO (MainThread) [supervisor.homeassistant.core] Detect a running Home Assistant instance

So things seem to work correctly.

@balloob
Copy link
Member

balloob commented Sep 30, 2023

Should we tag this for the beta?

Copy link
Member

@frenck frenck left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense, yes, let's pull this into beta 👍

But that might be intended behavior on Supervisor, IIRC?

That is intended indeed. 👍

../Frenck

@frenck frenck added this to the 2023.10.0 milestone Sep 30, 2023
@frenck frenck merged commit 9444a47 into dev Sep 30, 2023
@frenck frenck deleted the fix-rollback-on-core-crash branch September 30, 2023 08:43
@github-actions github-actions bot locked and limited conversation to collaborators Oct 1, 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