Homeassistant.set_location memory issue

Hi all,

In my van, I’m starting to play around with Home Assistant and Node-RED to show all my Victron equipment.

Now I’m pretty good on my way.
Since I’m driving in my house on wheels I like the function seeing my home location being updated by GPS on the road.

I installed on a Raspberry Pi 4 4GB, Home Assistant in Docker and first also had Node-RED in a container, but didn’t like that I can’t write files outside of this container. So I installed Node-RED with the install script locally. Added node-red-contrib-home-assistant-websocket and installed with HACS the connection according to: https://bit.ly/3tductt
All on the same Pi.

With the help of the Node-RED community I set up the service homeassistant.set_location which is doing almost what I want.

But than the problem started:
I had a couple of times a complete freeze of my Pi.

After a couple of days I narrowed the problem down to this Node-RED function who is filling up the memory of the Pi until it freezes.

I found this out by disabling the Node-RED flow and then using the Service profiler.start_log_objects.

The location is just growing and growing.

(Between lines the set_location was activated, then restart of HA)

Are there more people out there or might there be a problem somewhere?

I’m running all the latest versions of HA (docker), Node-RED (locally) and the integrations.

Thanks!

Edit: add screenshot

I don’t know if it is related or not because my environment is very different from yours. But in the last few days I have noticed a terrible memory leak as well. I am using Docker on a Synology, and not using Node-RED. But if I don’t restart every few hours, HA gets up into the GBs in memory usage and crashes.

Can you narrow it down?

using the Service profiler.start_log_objects. (install profiler integration).

It shows in the Log where the memory is growing…

Thanks @Sammerdan. I haven’t used the Profiler integration before. I installed it and am running a trace now.

I also created an issue, although maybe somewhat prematurely since I had no tangible items for them to research. I will add my Profiler logs, when complete. Perhaps you could add any info you have as well?

So, I’ve activated the set_location again and I see the memory disappearing again:

Logger: homeassistant.components.profiler
Source: components/profiler/__init__.py:221
Integration: Profiler (documentation, issues)
First occurred: 17:19:26 (322 occurrences)
Last logged: 19:59:59

Memory Growth: []
Memory Growth: [('Location', 271488, 1768), ('list', 289129, 1762), ('dict', 56887, 67), ('LocationGroup', 8484, 24), ('Astral', 707, 2), ('AstralGeocoder', 707, 2)]
Memory Growth: [('dict', 56922, 35), ('list', 289147, 18), ('Template', 22, 1)]
Memory Growth: [('Location', 273024, 1536), ('list', 290653, 1506), ('dict', 57013, 91), ('LocationGroup', 8532, 48), ('Astral', 711, 4), ('AstralGeocoder', 711, 4)]
Memory Growth: [('Location', 274176, 1152), ('list', 291796, 1143), ('dict', 57088, 75), ('LocationGroup', 8568, 36), ('Astral', 714, 3), ('AstralGeocoder', 714, 3)]

Every 30 seconds update.
Location and List are growing and growing.

It’s not stabelizing

@Sammerdan I believe my problem is very different from yours. But as you suggested, I ran Profiler today. I came up with the follow. Unless I am missing something, it looks like Arlo is the culprit. Agree?

Logger: homeassistant.components.profiler
Source: components/profiler/__init__.py:221
Integration: Profiler (documentation, issues)
First occurred: 12:48:11 PM (1020 occurrences)
Last logged: 9:17:44 PM

Memory Growth: [('ArloVideo', 16288, 3), ('HassJob', 2437, 2)]
Memory Growth: [('tuple', 54745, 6)]
Memory Growth: [('ArloVideo', 16292, 4)]
Memory Growth: [('method', 6078, 16), ('KeyedRef', 338, 11), ('SelectorKey', 89, 10), ('_SelectorSocketTransport', 78, 10), ('TransportSocket', 80, 10), ('tuple', 54753, 8), ('socket', 99, 7), ('weakref', 16202, 6), ('deque', 667, 6), ('ArloVideo', 16296, 4)]
Memory Growth: [('tuple', 54860, 107), ('cell', 45173, 68), ('function', 73242, 36), ('HassJob', 2453, 16), ('Comparator', 66, 14), ('_truncated_label', 34, 12), ('BindParameter', 56, 11), ('AnnotatedColumn', 28, 10), ('_ColumnEntity', 18, 6), ('_CompileLabel', 18, 6), ('set', 6949, 5), ('partial', 308, 5), ('BinaryExpression', 35, 5), ('_anonymous_label', 14, 5), ('property', 5318, 4), ('itemgetter', 413, 4), ('BooleanClauseList', 14, 4), ('ClauseList', 7, 2), ('Grouping', 3, 2), ('type', 6766, 1), ('QueryEventsDispatch', 4, 1), ('OrderedSet', 11, 1), ('quoted_name', 8, 1), ('SQLiteCompiler', 6, 1), ('prefix_anon_map', 6, 1), ('QueryContext', 3, 1), ('Select', 3, 1), ('Query', 3, 1), ('ResultMetaData', 3, 1), ('Response', 7, 1), ('ArloVideo', 16297, 1)]

Sorry, but I think I disagree.

First number (16288) is current size. Second one is grown with (3).

So previous was 16285.

As I understand these are bytes…
So you’ve 16MB in use with Arlovideo.
I think that’s fine?