tzapu / node-red-contrib-blynk

Blynk app integration with Node Red
MIT License
17 stars 5 forks source link

Problem each time I when I press deploy in node-red #3

Closed Toshibass closed 8 years ago

Toshibass commented 8 years ago

Hi I am getting the following on my ssh window each time I press deploy in node-red after I modify my flows :+1:

pi@raspberrypi ~ $ (node) warning: possible EventEmitter memory leak detected. 11 connect listeners added. Use emitter.setMaxListeners() to increase limit. Trace at addListener (events.js:179:15) at setupStatusEvents (/home/pi/.node-red/node_modules/node-red-contrib-blynk /blynk.js:14:24) at new BlynkWriteNode (/home/pi/.node-red/node_modules/node-red-contrib-blynk/blynk.js:83:3) at createNode (/usr/lib/node_modules/node-red/red/nodes/Flow.js:35:18) at Flow.start (/usr/lib/node_modules/node-red/red/nodes/Flow.js:392:44) at Object.module.exports.startFlows (/usr/lib/node_modules/node-red/red/nodes/flows.js:141:24) at /usr/lib/node_modules/node-red/red/nodes/flows.js:121:77 at tryCatchReject (/usr/lib/node_modules/node-red/node_modules/when/lib/makePromise.js:845:30) at runContinuation1 (/usr/lib/node_modules/node-red/node_modules/when/lib/makePromise.js:804:4) at Fulfilled.when (/usr/lib/node_modules/node-red/node_modules/when/lib/makePromise.js:592:4) (node) warning: possible EventEmitter memory leak detected. 11 disconnect listeners added. Use emitter.setMaxListeners() to increase limit.

The guys over at node-red suggest the problem could be : Possibly "not closing down the event listeners properly during the redeploy. Should be using the on close method to clean up."

Toshi

tzapu commented 8 years ago

hi, are you deploying fully, or one of the other 'just changes' methods? do you you have more than 10 blynk nodes?

tzapu commented 8 years ago

i looked into this and it seems directly connected with the number of blynk nodes deployed. they are being cleaned on close connection

this.on("close", function() {
            console.log('blynk server close', this.key);
            //TODO: cleanup
            //blynkConnection.disconnect();
            this.blynk.disconnect();
            this.blynk.removeAllListeners();
            this.pins = [];
            this.blynk = null;
        });

but if there are more than 10 nodes it adds more than 10 event listeners to check for status (connected/disconnected) updates. I am not sure if there is a better way of updating statuses than this.

tzapu commented 8 years ago

pushed a new version with a higher value in max event listeners... not sure if it s the proper way of handling this yet...

/edit seems ok, it was sorted the same in the mqtt nodes as well https://github.com/node-red/node-red/issues/71

please report if it does not work for you in 0.0.9