core: Memory usage increase and Updating ping binary_sensoe error
Home Assistant release with the issue: 0.95.4
Last working Home Assistant release (if known): 0.94.4
Operating environment (Hass.io/Docker/Windows/etc.): Hass.io
Component/platform:
Description of problem: After upgrade from 0.94.4 to 0.95.4 memory usage increase from 26% to 40-41% and have this error: Updating ping binary_sensor took longer than the scheduled update interval 0:00:30. I have most ping.bynary.sensor, and all stop working. In 0.94.4 works perfectly.
Problem-relevant configuration.yaml
entries and (fill out even if it seems unimportant):
Traceback (if applicable):
Additional information:
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 1
- Comments: 16 (1 by maintainers)
More testing, more thoughts.
First, I set up a new sensor to ping my Mac and ran a tcpdump to detect incoming pings, then manually updated the sensor in Home Assistant. Pings came through instantaneously - so there is no problem with delays affecting initiation of commands or scripts in sensors.
Next - I have separated the ping command from the sensor by putting it into a bash file.
Interestingly, when the AV receiver was on, this all worked fine. As soon as I turned it off, the status wouldn’t update to reflect it and I once again got:
Whilst still borked out in this state, I can still execute the shell script without any problems using the Configurator add-on - it works exactly as expected:
So here is my new theory: ping works fine in itself, but the way its responses are processed by the sensor or binary_sensor elements of HA are problematic, particularly if no packets are received. Due to the -w 5 header, the script shouldn’t (and doesn’t, as proven by testing in Configurator) take more than 5 seconds to execute a response, and the sensor should timeout anyway after 15 seconds - but it doesn’t. It lingers, stuck, apparently waiting for a response, indefinitely, until HA is restarted.
Could someone pick this up and take a look as to why it doesn’t work in docker installation as intended?
Brand new install, this time on an SSD using HassOS 3.5 and USB booting. So, so much faster and has fixed almost all the usual errors that would occur except this one.
Error first gets logged at 10:20pm. You can see the CPU and RAM spikes that coincide with it, but no apparent changes to network connectivity. The sensor that broke in this case was the CPU temperature sensor, which doesn’t require any network connectivity anyway.
Here are all my command_line sensors, in case anyone can see what is causing the issue:
I am having the same issue. HassOS, rPI 3B+, 0.95.4
Not seeing quite the same problems with CPU usage as above but after a few hours my ping binary sensors stop working with the same error - took longer that scheduled update interval.
I have tried converting to command line binary sensors instead but this yields the same issue after working initially:
Therefore I believe the issue is with the way Hassio handles any ping request, and not necessarily the specific ping components.