Z-Wave-Me / home-automation

Z-Way Home Automation engine

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

eventemitter2.js throws error after warning

pmbert opened this issue · comments

After warning for possible memory leak eventemitter2.js throws an error.
This is fatal, if module stops working for this reason.
Code at that place in eventemitter2.js: console.trace();

Log:

[2019-05-05 18:26:15.999] [I] [core] (node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit. 11
[2019-05-05 18:26:16.006] [E] [core] Callback execution error: TypeError: undefined is not a function
    at EventEmitter.on [as addListener] (automation/lib/eventemitter2.js:392:29)
    at _.extend.on (automation/classes/DevicesCollection.js:200:37)

Z-Way version v2.3.8

Do you have a lot of subscriptions to the same device change?

You can change defaultMaxListeners at the top of automation/lib/eventemitter2.js and see at which number this message disappears. Then it is worth to analyse why do you have so mane subscriptions.

May be it is worth to increase this value by default

Do you have a lot of subscriptions to the same device change?

As far as I understand this happens, if several instances are waiting for change of the same metric of the same device. Yes I have.

May be it is worth to increase this value by default

The warning is not the problem. Problem is, that eventemitter2 throws an exception after the warning and the module goes wrong.

I already tried to increase the limit with emitter.setMaxListeners() as mentioned in the warning. But with no effect. Either it doesn't work or I haven't understood how to do it right.

Now I removed the lines 'console.trace();' from eventemitter2. Seems that it's not defined.