Since updating to 0.87.1 my RPi 3 based hassbian system has been stopping for out of memory errors.
I see these in the log file:
2019-02-27 19:21:52 ERROR (MainThread) [homeassistant.helpers.entity] Update for sensor.cpu_speed fails
Traceback (most recent call last):
File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/helpers/entity.py", line 221, in async_update_ha_state
await self.async_device_update()
File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/helpers/entity.py", line 349, in async_device_update
await self.hass.async_add_executor_job(self.update)
File "/usr/lib/python3.5/asyncio/futures.py", line 380, in __iter__
yield self # This tells Task to wait for completion.
File "/usr/lib/python3.5/asyncio/tasks.py", line 304, in _wakeup
future.result()
File "/usr/lib/python3.5/asyncio/futures.py", line 293, in result
raise self._exception
File "/usr/lib/python3.5/concurrent/futures/thread.py", line 55, in run
result = self.fn(*self.args, **self.kwargs)
File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/components/sensor/cpuspeed.py", line 84, in update
self.info = cpuinfo.get_cpu_info()
File "/srv/homeassistant/lib/python3.5/site-packages/cpuinfo/cpuinfo.py", line 2141, in get_cpu_info
CopyNewFields(info, _get_cpu_info_from_dmesg())
File "/srv/homeassistant/lib/python3.5/site-packages/cpuinfo/cpuinfo.py", line 1510, in _get_cpu_info_from_dmesg
returncode, output = DataSource.dmesg_a()
File "/srv/homeassistant/lib/python3.5/site-packages/cpuinfo/cpuinfo.py", line 159, in dmesg_a
return run_and_get_stdout(['dmesg', '-a'])
File "/srv/homeassistant/lib/python3.5/site-packages/cpuinfo/cpuinfo.py", line 248, in run_and_get_stdout
p1 = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, stdin=subprocess.PIPE)
File "/usr/lib/python3.5/subprocess.py", line 676, in __init__
restore_signals, start_new_session)
File "/usr/lib/python3.5/subprocess.py", line 1221, in _execute_child
restore_signals, start_new_session, preexec_fn)
OSError: [Errno 12] Cannot allocate memory
I also see this in a top display:
Tasks: 118 total, 2 running, 70 sleeping, 0 stopped, 0 zombie
%Cpu(s): 5.4 us, 1.8 sy, 0.0 ni, 87.6 id, 4.5 wa, 0.0 hi, 0.7 si, 0.0 st
KiB Mem : 949452 total, 25616 free, 873804 used, 50032 buff/cache
KiB Swap: 102396 total, 0 free, 102396 used. 20892 avail Mem
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
6807 homeass+ 20 0 762680 537032 3220 S 22.4 56.6 249:26.16 hass
I have a system monitor sensor for memory usage and I see this:
I see this from systemctl now. Other times I have seen HASS as stopped due to “out of memory”:
pi@hassbian:~ $ sudo systemctl status [email protected]
● [email protected] - Home Assistant for homeassistant
Loaded: loaded (/etc/systemd/system/[email protected]; enabled; vendor preset: enabled)
Active: active (running) since Fri 2019-02-22 08:30:15 CST; 5 days ago
Main PID: 6807 (hass)
CGroup: /system.slice/system-home\x2dassistant.slice/[email protected]
└─6807 /srv/homeassistant/bin/python3 /srv/homeassistant/bin/hass
Feb 27 19:32:30 hassbian hass[6807]: 2019-02-27 19:32:30 INFO (MainThread) [homeassistant.components.http.view] Serving /api/states/variable.sunset to 127.0.0.1 (auth: True)
Feb 27 19:32:30 hassbian hass[6807]: 2019-02-27 19:32:30 INFO (MainThread) [homeassistant.components.http.view] Serving /api/states/variable.sunrise to 127.0.0.1 (auth: True)
Feb 27 19:32:39 hassbian hass[6807]: 2019-02-27 19:32:39 WARNING (MainThread) [homeassistant.components.weather] Updating ecobee weather took longer than the scheduled update i
Feb 27 19:32:43 hassbian hass[6807]: 2019-02-27 19:32:43 INFO (Thread-8) [homeassistant.components.sensor.command_line] Running command: python /home/homeassistant/.homeassista
Feb 27 19:32:59 hassbian hass[6807]: 2019-02-27 19:32:59 INFO (Thread-20) [homeassistant.components.sensor.command_line] Running command: cat /sys/class/thermal/thermal_zone0/t
Feb 27 19:33:01 hassbian hass[6807]: 2019-02-27 19:33:01 INFO (Thread-5) [homeassistant.components.sensor.command_line] Running command: systemctl status [email protected]
Feb 27 19:33:01 hassbian hass[6807]: 2019-02-27 19:33:01 INFO (Thread-19) [homeassistant.components.sensor.command_line] Running command: systemctl status influxd.service | awk
Feb 27 19:33:01 hassbian hass[6807]: Warning: influxdb.service changed on disk. Run 'systemctl daemon-reload' to reload units.
Feb 27 19:33:10 hassbian hass[6807]: 2019-02-27 19:33:10 WARNING (MainThread) [homeassistant.components.weather] Updating ecobee weather took longer than the scheduled update i
Feb 27 19:33:25 hassbian hass[6807]: 2019-02-27 19:33:25 INFO (MainThread) [homeassistant.components.http.view] Serving /api/states/variable.garage_temp_rate to 127.0.0.1 (auth
Feb 27 19:33:25 hassbian hass[6807]: 2019-02-27 19:33:25 INFO (MainThread) [homeassistant.components.http.view] Serving /api/states/variable.garage_temp_delta to 127.0.0.1 (aut
It’s probably not related but I use a custome component “variable” that has stopped working in that it shows a configuration error.
Any ideas how to figure this one out?