Fixing "MaxListenersExceededWarning: Possible Eventemitter memory leak detected"?

I'm using Node-Red v3.1.3 as a docker container and just recently had to restart the container and by chance got the following entry in the logfiles:

6 Jan 14:46:39 - [info] Started flows

(node:7) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 changed listeners added to [EventEmitter]. Use emitter.setMaxListeners() to increase limit

(Use `node --trace-warnings ...` to show where the warning was created)

I don't know what "node --trace-warning" means and so far everything within Node-Red (running 12 nodes) works as expected.
what I see on top on the host:

Tasks: 401 total,   1 running, 400 sleeping,   0 stopped,   0 zombie
%CPU(s):  2,9 us,  1,9 sy,  0,0 ni, 94,6 id,  0,2 wa,  0,0 hi,  0,5 si,  0,0 st
MiB Spch:  31999,4 total,  13946,1 free,   5783,6 used,  12877,6 buff/cache
MiB Swap:    976,0 total,    976,0 free,      0,0 used.  26215,8 avail Spch

    PID USER      PR  NI    VIRT    RES    SHR S  %CPU  %MEM     ZEIT+ BEFEHL
3574439 thomas    20   0   10,4g 211884  41368 S   6,3   0,6   0:49.47 node-red
...

Do i have to do something? And how can I find out, which node(s) cause this WARNing?

Hi @binderth

This is a common message, and its usually safe to not pay too much attention to it.
it just means there are > 10 subscribers to an event.

if you can advise what Node 7 is, I'm sure some friendly folk around here will have a look at the code, just to confirm that it isn't much to worry about.

1 Like

I named my nodes, so how can I find out, which one is node 7?

Mmmm...

Can you export your flow and share it here?

That isnt a great deal of use without you telling us what kind of node that is!

The error suggests that you have a node that you have named 7.

I don't have a node with a "name": 7...? so I thought it was node #7, but I don't know how to count them?

As I asked here - it will likely be the 7th Node in the export

1 Like

The text (node:7) has nothing to do with Node-RED. This is a node.js warning and that is what node refers to in this instance.

The only clue we have is it will most likely be something you have more than 10 instances of in your flows.

What extra nodes have you got installed and using?

1 Like
  • ok, I have a "mqtt-broker" as global configuration node, which I use 191 times (in my older flows I sometimes use functions to split a JSON and they do all have a seperate instance of mqtt).
  • and I do have a "bluelinky" node, which I use 17 times.
  • "modbus" => 24 times
  • "tibber" => 10 times

neither of them is in the export at 6th or 7th place (what I supect would be node #7)

So "tibber" is your guy

No, just a warning message
Usually the maximum option is disabled or not set. Some developers deactivate the maximum number, others are not aware of this (the case here I think) and still others prefer to define a number to avoid any risk of a loop hidden by this deactivation...

If a node subscribes to an event there is only one listener but if you have 100 nodes...

2 Likes

Why have you ruled out the others?

It won't be the mqtt-broker node as we have done the work to avoid that warning in our node.

I doubt it'll be the modbus node as it is widely used and I'm not aware of other reports of this.

That leaves either tibber or bluelinky.

Given there are 10 instances of the tibber node, and the warning says an 11th listener has been registered, I'd suspect the bluelinky node.

It should be harmless, but it is worth tracking down and raising an issue against the node in question to avoid this question being asked again.

1 Like

Woops, I had 10 in mind, sorry

I had the same reasoning
Modbus verified, not them

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.