Page 1 of 1

Memory leak in hardware type Domoticz - Remote Server

Posted: Thursday 02 January 2025 17:35
by thelbekk
Version: current HEAD of development branch
Platform: NetBSD/amd64-current
Plugin/Hardware: RFXCOM, OpenZWave, and Domoticz - Remote Server
Description:

I'm running two Domoticz installations, both currently running the very latest HEAD of development. The main one is on NetBSD/amd64-current, and the secondary on NetBSD/evbarm64-current. Each has RFXCOM and OpenZWave hardware adapters on USB, with a rather small number of devices behind them; about 20 ZWave devices and 10 4.33MHz devices on the main installation, and about 10 of each on the secondary one. The main one uses the Domoticz - Remote Server hardware type to connect to the secondary, and receive a feed of all its transactions.

And yes, OpenZWave. I'd like to move to the MQTT based setup, but I would have to port the ZWave part of that to NetBSD first, and haven't gotten around to doing more with that than just enough to realize that it'll take quite a bit of work.

I was running the very last commit before OpenZWave got removed until recently, and this memory leak was crashing domoticz on my main installation rather frequently, so when, over Christmas, I discovered that OZW had been taken back on board, I upgraded. That was completely painless, but the memory leak is still there.

When the remote connection is active, the main (receiving) system leaks memory continuously. I also see that if there is more activity at the remote, and thus more data being transfered, the leak is faster. We're talking about a gigabyte per day, even with this small installation being tapped. If I disable the remote connection, the memory usage of the main Domoticz instance immediately stops growing, and stays flat. When I re-enable it, the growth resumes. Eventually, the domoticz process gets a segfault and dies.

I've been reading the code in hardware/ASyncTCP* and hardware/Domoticz*, but haven't found anything that looks wrong. I have not studied the JSON code yet.

If anyone has any hints or ideas for me on how to proceed, I'd be very grateful!

-tih

Re: Memory leak in hardware type Domoticz - Remote Server

Posted: Monday 06 January 2025 7:45
by thelbekk
Never mind - turns out the bug was elsewhere. :)

Not finding anything that looked fishy in the relevant Domoticz source code, I upgraded the OS to a newer snapshot, and it turns out the memory leak was a (now fixed) bug in a library.