HA crashes every few days

I’m running Hassbian on an RPi3B+ from a USB flash drive, not an SD card. I keep getting lots of errors similar to the following:

2019-07-11 20:08:05 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection.1557461168] Error handling message: Unauthorized
Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/components/websocket_api/connection.py", line 84, in async_handle
    handler(self.hass, self, schema(msg))
  File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/components/websocket_api/commands.py", line 52, in handle_subscribe_events
    raise Unauthorized
homeassistant.exceptions.Unauthorized: Unauthorized

or this:

2019-07-10 22:09:42 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection.1723359920] Error handling message: Unauthorized
Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/components/websocket_api/connection.py", line 84, in async_handle
    handler(self.hass, self, schema(msg))
  File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/components/websocket_api/commands.py", line 52, in handle_subscribe_events
    raise Unauthorized
homeassistant.exceptions.Unauthorized: Unauthorized
2019-07-11 06:45:25 ERROR (MainThread) [homeassistant.core] Error doing job: SSL handshake failed
Traceback (most recent call last):
  File "/usr/lib/python3.7/asyncio/sslproto.py", line 625, in _on_handshake_complete
    raise handshake_exc
  File "/usr/lib/python3.7/asyncio/sslproto.py", line 189, in feed_ssldata
    self._sslobj.do_handshake()
  File "/usr/lib/python3.7/ssl.py", line 763, in do_handshake
    self._sslobj.do_handshake()
ssl.SSLError: [SSL: HTTP_REQUEST] http request (_ssl.c:1056)
2019-07-11 06:45:25 ERROR (MainThread) [homeassistant.core] Error doing job: SSL error in data received
Traceback (most recent call last):
  File "/usr/lib/python3.7/asyncio/sslproto.py", line 526, in data_received
    ssldata, appdata = self._sslpipe.feed_ssldata(data)
  File "/usr/lib/python3.7/asyncio/sslproto.py", line 189, in feed_ssldata
    self._sslobj.do_handshake()
  File "/usr/lib/python3.7/ssl.py", line 763, in do_handshake
    self._sslobj.do_handshake()
ssl.SSLError: [SSL: HTTP_REQUEST] http request (_ssl.c:1056)

Then everything becomes unresponsive: web access, SAMBA, ssh, etc. but the lights are still blinking on my RPi. So I have to reset by unplugging the Pi. I installed Let’s Encrypt/Duck DNS using the Hassbian scripts and I’m running the latest HA version. Any ideas or ways I can go about debugging this?

I see you are running Python 3.7 since HASSbian sort of forces that.
When I was running Python 3.7 I found openzwave could lock up Home Assistant. I would expect there are other software pieces that have not been thoroughly tested with Python 3.7
I am not sure what to recommend since you cannot easily use HASSbian with Python 3.6 or 3.5 any longer.

Looks like ssl errors to me. Do you have the baseURL configured in config yaml file? Is it correct?

base_url is: MYSUBDOMAIN.duckdns.org:8123

But my actual sub domain.

have you tried with https:// at the front of that base url?

I changed base_url to start with “https://” and I’m now logging memory usage and processor usage to see if they are maxing out just before a crash.

Do you have any references or places I can read about compatibility? All of my devices are Zwave except for my ecobee thermostat. If there’s something I can do to correct this I would like to.

I do not have any references except for personal experience. I ended up moving over to OpenHAB.
The dev for their zwave driver is really good and works professionally in the zwave field. He offered to collaborate with openzwave and they refused.

As much as I detest Java, OH works reliably and recognized all my zwave devices without needing to rebuild my network.

Dang, I’m really enjoying the HA experience so far and did a lot of research to get my setup the way I want it. Z-Wave is super fast (seems instantaneous to me) and I really want to stay with my RPi. What hardware are you using? If RPi, have you had any performance issues running OpenHAB and how responsive is Z-Wave?

No issues running on a Pi 3B+ with a USB connected SSD I had lying around.
When I first tried, one of my battery operated devices did not get recognized properly. I worked with the Dev, turned on debug logging, & restarted the binding. Of course, then everything worked as expected.

I have not yet done much with my zwave network, but it should run the dame, f you can convert your HA Automations to OH rules. OH runs a zwave network heal every night at 2AM.

Load is not bad either. Swap usage is 0.

image

Thank you for your input. I will continue to play with HA for a while, but if it isn’t reliable enough then I may backout and go with OH. HA always seems to crash when I’m out of town and trying to check on things remotely, which is unacceptable.

Is it safe to assume if I switch to running HA from Docker then I could control the python version better and avoid these hassbian issues with the switch to Raspbian Buster? I’m not familiar with Docker, but the tutorials online seem very straightforward. Would the correct python version be contained within the HA container and be correct for a reliable Z-Wave network? That’s what I can’t figure out from reading online.

I think they are including Python 3.7 in the Docker container because they want to move away from 3.5.
I personally do not think stability is a high priority for the developers right now.

I run HA from Python 3.7 with openzwave and experience no issues.
There is no compatibility/stability issues with openzwave and Python 3.7.

Edit: As for your original issue, it sounds very much like you are running out of RAM, this could be a result of many things, recommend keeping htop or top running in a SSH window or at the console so you can see what’s eating all your RAM up.

I have now uninstalled duckdns/let’sencrypt using the hassbian script and removed http: remote access from HA. We’ll see if that gets rid of any crashes. top only shows 20% RAM usage, which matches the systemmonitor component in HA. It may be that the http or zwave components get hung up during some process and eat all my RAM up, but I haven’t been able to get a good log of it yet. We’ll see I guess.

how big is your db file?

1 Like

It’s only 72MB. I have it purging every day to keep only 7 days of history and I only log important stuff that I’m really interested in.

1 Like

So far so good. Performance, CPU use, and memory use has been stable. I’ll post here if anything changes, but so far just using homekit for remote control is working great.