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

home-assistant: use SIGINT instead of SIGTERM to shut down #49571

Merged
merged 1 commit into from Nov 1, 2018

Conversation

peterhoeg
Copy link
Member

Motivation for this change

hass will ignore the standard SIGTERM sent by systemd during stop/restart and we then have to wait for the timeout after which systemd will forcefully kill the process.

If instead if we send SIGINT, hass will shut down nicely.

There are many issues reported upstream about the inability to shut down/restart and it is supposed to work with SIGTERM but doesn't.

Cc: @dotlambda

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Fits CONTRIBUTING.md.

hass will ignore the standard SIGTERM sent by systemd during stop/restart and we
then have to wait for the timeout after which systemd will forcefully kill the
process.

If instead if we send SIGINT, hass will shut down nicely.

There are many issues reported upstream about the inability to shut down/restart
and it is *supposed* to work with SIGTERM but doesn't.
@GrahamcOfBorg
Copy link

Success on x86_64-linux (full log)

Attempted: home-assistant

Partial log (click to expand)

copying path '/nix/store/lmhhsik3sikbhvwkz2yxzpf8s7dylixl-python3.6-pyOpenSSL-18.0.0-dev' from 'https://cache.nixos.org'...
copying path '/nix/store/79q3g5dydqbdlmivwhyk1c0c4zn1yrdv-python3.6-PyJWT-1.6.4' from 'https://cache.nixos.org'...
copying path '/nix/store/bydjasqfss5fpjxy176gy4g1l13n77mv-python3.6-aiohttp-3.4.4' from 'https://cache.nixos.org'...
copying path '/nix/store/0wvmxml6fr84ri7j99pyckn4if80ihv7-python3.6-home-assistant-frontend-20181026.1' from 'https://cache.nixos.org'...
copying path '/nix/store/y5jab996rxy00dm3l0czd28x4gvq8qqd-python3.6-urllib3-1.23' from 'https://cache.nixos.org'...
copying path '/nix/store/c02wgvdgp14r11xywllxzw9iqf6haxf6-python3.6-aiohttp-cors-0.7.0' from 'https://cache.nixos.org'...
copying path '/nix/store/id55cwgp6jwl0y8r2pc5hbjbxylp626z-python3.6-requests-2.20.0-dev' from 'https://cache.nixos.org'...
copying path '/nix/store/iskkfb6xp5xdn3lj1r7xkvii9bbf2bhg-python3.6-astral-1.6.1' from 'https://cache.nixos.org'...
copying path '/nix/store/m9xl0hkfxjwkxffzccjdkwx1c6cgpvpy-homeassistant-0.81.2' from 'https://cache.nixos.org'...
/nix/store/m9xl0hkfxjwkxffzccjdkwx1c6cgpvpy-homeassistant-0.81.2

@GrahamcOfBorg
Copy link

Success on aarch64-linux (full log)

Attempted: home-assistant

Partial log (click to expand)

tests/components/test_init.py .................                          [ 87%]
tests/components/test_introduction.py .                                  [ 88%]
tests/components/test_logger.py ......                                   [ 90%]
tests/components/test_script.py .....                                    [ 91%]
tests/components/test_shell_command.py ........                          [ 94%]
tests/components/test_system_log.py ................                     [100%]

========================= 296 passed in 25.19 seconds ==========================
pytestcachePhase
/nix/store/c8jwiy698jm0kvxisb72fq6w2787g5nj-homeassistant-0.81.2

@peterhoeg
Copy link
Member Author

@GrahamcOfBorg test home-assistant

@GrahamcOfBorg
Copy link

Success on x86_64-linux (full log)

Attempted: tests.home-assistant

Partial log (click to expand)

killing hass (pid 597)

### home-assistant.log ###
2018-11-01 02:19:00 WARNING (MainThread) [homeassistant.bootstrap] Skipping pip installation of required modules. This may cause issues
2018-11-01 02:19:00 WARNING (MainThread) [homeassistant.components.http] legacy_api_password support has been enabled. If you don't require it, remove the 'api_password' from your http config.
2018-11-01 02:19:08 WARNING (MainThread) [hbmqtt.mqtt.protocol.handler] BrokerProtocolHandler Unhandled exception in reader coro: IncompleteReadError('0 bytes read on a total of 1 expected bytes',)

vde_switch: EOF on stdin, cleaning up and exiting
vde_switch: Could not remove ctl dir '/build/vde1.ctl': Directory not empty
/nix/store/51ipb38znr936v53dj957bspd1675756-vm-test-run-home-assistant

@GrahamcOfBorg
Copy link

Success on aarch64-linux (full log)

Attempted: tests.home-assistant

Partial log (click to expand)

killing hass (pid 631)

### home-assistant.log ###
2018-11-01 02:25:57 WARNING (MainThread) [homeassistant.bootstrap] Skipping pip installation of required modules. This may cause issues
2018-11-01 02:25:57 WARNING (MainThread) [homeassistant.components.http] legacy_api_password support has been enabled. If you don't require it, remove the 'api_password' from your http config.
2018-11-01 02:26:02 WARNING (MainThread) [hbmqtt.mqtt.protocol.handler] BrokerProtocolHandler Unhandled exception in reader coro: IncompleteReadError('0 bytes read on a total of 1 expected bytes',)

vde_switch: EOF on stdin, cleaning up and exiting
vde_switch: Could not remove ctl dir '/build/vde1.ctl': Directory not empty
/nix/store/4vpwynbi9s0sixdzlpzqvsgbgqmrwb9l-vm-test-run-home-assistant

@dotlambda
Copy link
Member

I don't have this problem. Also, I can't seem to reproduce it in the test. Can you?
The behaviour may be dependent on some component that is not properly implemented.

@peterhoeg
Copy link
Member Author

Also, I can't seem to reproduce it in the test. Can you?

100%. Without this, I'm waiting for timeout every time.

@dotlambda
Copy link
Member

Well, I guess since this shouldn't cause any harm we can just merge it.

@dotlambda dotlambda merged commit db1a40a into NixOS:master Nov 1, 2018
@peterhoeg peterhoeg deleted the f/hassint branch November 2, 2018 01:11
@peterhoeg peterhoeg restored the f/hassint branch November 2, 2018 02:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants