ioBroker / ioBroker.sonoff

Control Sonoff-Tasmota devices via ioBroker
MIT License
37 stars 28 forks source link

[CLOSED] Sonoff.0 used RAM growing up to 2GB. EndaevourOS/Arch System #287

Closed unsermanninchina closed 1 year ago

unsermanninchina commented 1 year ago

I have one up to date instance of the sonoff adapter with almost 20 tasmota driven sonoffs and ESP6288. I have attached HTU21D, DS18b20 and some Relais, nothing fancy, no displays. While it was working ok but slow on a Raspberry 2B is was first much better after I changed to a HP T620 (Running Linux, too). But since a while I have more and more problems with very slow or no reaction, mainly like no reaction on RF-switches (via RFresc) but as well with scenes or scripts, again with slow or no reaction of the devices. A restart fixes the problem for a while.

Some days ago I found out that the Sonoff adapter is increasingly using RAM. The use of RAM just a moment ago growed up to 2GB. My HP T620 has 4GB, I ordered 8GB more, which might be a solution, but is it normal that the RAM usage grows so high? A restart of the instance lowers the RAM use to 150 MB, but now, after 10 Minutes it's up again to 425MB, 12 min up to 500MB...

If that's not normal, maybe any hints where to start searching for the reason? Thank you! Marcus

Apollon77 commented 1 year ago

Which node.js version is used? There are versions that have memory leaks

unsermanninchina commented 1 year ago

Hi @Apollon77, thank you for your question!

$ uname -m && type -P nodejs node npm && nodejs -v && node -v && npm -v && iob -v
x86_64
/usr/bin/nodejs
/usr/bin/node
/usr/bin/npm
v19.1.0
v19.1.0
8.19.2
4.0.23

Is here a version with memory leaks?

This is copied from the browser admin info:

CPUs: 4 Geschwindigkeit: 948 MHz Modell: AMD GX-415GA SOC with Radeon(tm) HD Graphics RAM: 3.2 GB System-Betriebszeit: 07:11:44 Node.js: v19.1.0 time: 1669842740010 timeOffset: -480 Adapter-Anzahl: 446 NPM: v8.19.2 Datenträgergröße: 12.8 GB Freier Festplattenspeicher: 8.2 GB Betriebszeit: 07:11:36 Aktive Instanzen: 10 Pfad: /opt/iobroker/ aktiv:

At the moment, after running the whole night (I am GMT + 8), Sonoff.0 uses only 190-200MB.

Apollon77 commented 1 year ago

Hm ... lets phrase it that way ... nodejs 19 is "bleeding edge development version" and officially not supported ... Please use Node.js 18 with is LTS and supported basically.

unsermanninchina commented 1 year ago

OK, I will downgrade nodejs to version 18. Node and npm can keep the versions? I was not aware I got an unsupported version into my system. I will leave a comment how it works. Thank you, @Apollon77

unsermanninchina commented 1 year ago

I forgot, I have an EndeavourOS, headless system. That is where the version 19 comes from. I installed version 18: yay -S nodejs-lts-hydrogen restarted and run iobroker fix.

$ uname -m && type -P nodejs node npm && nodejs -v && node -v && npm -v && iob -v 
x86_64
/usr/bin/nodejs
/usr/bin/node
/usr/bin/npm
v18.12.1
v18.12.1
8.19.2
4.0.23

I gonna see if this changes the RAM usage.

Apollon77 commented 1 year ago

Yes npm version is ok. In fact honestly: RAM could still be an issue ... but with Node.js 19 noone knows if it is caused by that ;-)

unsermanninchina commented 1 year ago

I will add 8GB as soon as it arrives. Since the change the RAM usage of Sonoff.0 is staying at ~125MB, free RAM is 60%, almost 2 GB, now. I will mark this thread as closed. Thank you so much for your help, very much appreciated!