Maxlisteners in Logfiles?

Hey guys,

I have a bit trouble again with my 8 shelly-plug-s.
All of them send the powerusage to the mqtt broker and I have set up a Gauge and a Chart for every device and one Gauge/Chart for all of them (sum).

After a couple hours my node-red is freezing and the dashboard page as well.

If I look into the docker log files I can find something like this:

(node:17) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 nodes-started listeners added to [EventEmitter]. Use emitter.setMaxListeners() to increase limit

Does this depends on too much messages of my mqtt broker to node-red because of my shelly's?

In the past I did a delay node between the mqtt input node and the chart/gauge node with dropping everything except 1 msg / 15 sec. That did the job this way, that node-red isn't freezing completly anymore but the Dashboard where I got all the gauge/charts is not that fast at all to display my measured values.

Can someone help me?
Thank you in advance.

Nice

PS: Node-RED is running the latests official docker-image on a raspberry pi 4b with 4 GB.

That’s a warning not an error, so won’t directly be causing the issue.
But what were displaying?
If you have a sensor giving a value every second, after two hours you would have 7200 points to display. How wide is your screen?

My guess is your browser is slowing down/freezing because of the number of data points you are storing.

1 Like

The shellys will report a value every time they measure a different value since last time they measured. Sometimes I get multiple values in 5 seconds for the same sensor/device and sometimes not.

Unfurtunately I can't reduce the amount they should report to the broker.

So is it the best way I did before with the delay node and reducing the msg to 1 every 15 sec? Or is there a better way doing this inside of node-red?

EDIT: oh and the problem is coming from the chartnode if I understand you right? and not from the gauge node?

Yes that is probably the simplest way, with the node set to rate limit and discard intermediate values.
Yes it is the chart that causes the problem. Every time a new sample arrives that is sent to the browser and the browser has to shuffle all the data down to put the new one in, which if there are thousands of points and they are coming in rapidly can impose a significant overhead on the processor.

1 Like

thank you colin :slight_smile:

Then I will set up the ratelimit to the charts only instead of gauge and chart.
1 msg every 5 minutes would be enough for the charts in my opinion.