Enjoying HA a great deal but recently I saw a problem closing it down - doesn’t seem to close properly, am starting to think it’s one of my configuration settings that might be preventing HA closing / restarting elegantly…
^CINFO:homeassistant.core:Stopping INFO:homeassistant.core:Bus:Handling <Event homeassistant_stop[L]> INFO:homeassistant.components.wemo:Shutting down subscriptions. INFO:homeassistant.components.recorder:Closing database INFO:netdisco.service:Scanning
Above logging output shows m pressing ctrlC and then waiting, it quickly goes to “closing database” but then hangs there for a min or so, then i see, INFO:netdisco.service:Scanning… So it never actually shutsdown as I’d expect it to.
If I ctrl-c again it quits (inelegantly).
INFO:netdisco.service:Scanning ^CTraceback (most recent call last): File "/usr/local/bin/hass", line 11, in <module> sys.exit(main()) File "/usr/local/lib/python3.4/dist-packages/homeassistant/__main__.py", line 386, in main exit_code = setup_and_run_hass(config_dir, args) File "/usr/local/lib/python3.4/dist-packages/homeassistant/__main__.py", line 308, in setup_and_run_hass exit_code = int(hass.block_till_stopped()) File "/usr/local/lib/python3.4/dist-packages/homeassistant/core.py", line 109, in block_till_stopped self.stop() File "/usr/local/lib/python3.4/dist-packages/homeassistant/core.py", line 117, in stop self.pool.stop() File "/usr/local/lib/python3.4/dist-packages/homeassistant/util/__init__.py", line 381, in stop self.block_till_done() File "/usr/local/lib/python3.4/dist-packages/homeassistant/util/__init__.py", line 375, in block_till_done self._work_queue.join() File "/usr/lib/python3.4/queue.py", line 86, in join self.all_tasks_done.wait() File "/usr/lib/python3.4/threading.py", line 290, in wait waiter.acquire() KeyboardInterrupt pi@custard-pi:~ $
Anyone got an idea what might be happening here or seen similar.
I ask because I’ve been noticing the same thing on occasion with my Pi3 that I set up with the AIO installer. Just curious; do you have a lot of sensor templates in use?
Well that rules out that idea. I just started using a number of sensor templates as a result of implementing this:
and was wondering if all the template sensors are causing a worker pool traffic jam. Have you grepped your log for worker pool tasks? Seeing any lineups in the queue?
I had tracked the issue down to the MQTT Event Feed - that prevented shutdown 100% of the time, but now I am no longer using it, I still get a failure to shutdown cleanly perhaps 50% or so of the time.
I do have a large number of sensors and templates.
I ddi some testing to try and isolate the problem and I think I have !
So I tried a fresh install on a Pi with default config and without any items auto dsicovered - shutdown is fine.
I took my own install and deleted the config and restarted - only thing discovered was hue lights - shutdown stalls.
I took my own install and editted the default config to disable device discovery and restarted - nothing discovered predictably, shutdown is instant!
So it’s the hue lights / hub somehow stopping the shutdown, no message in the log though - that’s my reading anyway.
It may not be the Hue specifically - the system will be a heck of a lot less busy with no device state to worry about. I have Hue and ZWave, so I’ll run a test to see if disabling the hue but leaving the ZWave running helps, although as I previously observed things are alot better for me on the latest release.
Just wanted to observe that without any particular changes my system has been a lot more stable and a LOT better about shutting down since the new web piece went in a couple of releases ago. It is now the exception rather than the rule that it fails so shutdown.