jdomeij / node-red-contrib-node-hue

Node RED nodes for controlling Philips Hue lights
Apache License 2.0
17 stars 8 forks source link

Maximum call stack size exceeded #12

Closed volkerrichert closed 6 years ago

volkerrichert commented 6 years ago

On a simple light group with two lamps i got "Maximum call stack size exceeded"

jdomeij commented 6 years ago

This most likely is because you have something that triggers on the hue input node to send message to the hue output node. So when an update is triggered it will be sent to the output node and generate a new update event. This will result in an infinite loop and stack overflow, I will look into fixing this but you still need to look over your setup because this will flood your system with updates.

I currently have 4 groups in my setup without problems

volkerrichert commented 6 years ago

Maybe i found the reason. I start to to some tests to find the reason for that issue. I build a flow like the one you described in your dashboard example with my RGBW lamp.

After deploying it node red will be fluted be more then 5500 identical events.

` [start at line 432ff] Wed, 29 Nov 2017 12:36:12 GMT follow-redirects options { maxRedirects: 21, protocol: 'http:', hostname: '192.168.120.253', port: '80', path: '/api/-PDgDVUiqSjvevZVBExowzMUn1kvhPtyLO-VCLsw/lights', method: 'GET', headers: { Accept: 'application/json', 'User-Agent': 'axios/0.15.3' }, agent: undefined, auth: undefined } Wed, 29 Nov 2017 12:36:12 GMT express:router:route new '/sonosSearch' Wed, 29 Nov 2017 12:36:12 GMT express:router:layer new '/sonosSearch' Wed, 29 Nov 2017 12:36:12 GMT express:router:route get '/sonosSearch' Wed, 29 Nov 2017 12:36:12 GMT express:router:layer new '/' Wed, 29 Nov 2017 12:36:12 GMT follow-redirects options { maxRedirects: 21, protocol: 'http:', hostname: '192.168.120.253', port: '80', path: '/api/-PDgDVUiqSjvevZVBExowzMUn1kvhPtyLO-VCLsw/groups', method: 'GET', headers: { Accept: 'application/json', 'User-Agent': 'axios/0.15.3' }, agent: undefined, auth: undefined } Wed, 29 Nov 2017 12:36:12 GMT socket.io-parser encoding packet {"type":2,"data":["update-value",{"value":false,"id":"7459cf9d.bcf5a"}],"nsp":"/"} Wed, 29 Nov 2017 12:36:12 GMT socket.io-parser encoded {"type":2,"data":["update-value",{"value":false,"id":"7459cf9d.bcf5a"}],"nsp":"/"} as 2["update-value",{"value":false,"id":"7459cf9d.bcf5a"}] Wed, 29 Nov 2017 12:36:12 GMT socket.io-parser encoding packet {"type":2,"data":["update-value",{"value":20,"id":"34b96324.e02b4c"}],"nsp":"/"} Wed, 29 Nov 2017 12:36:12 GMT socket.io-parser encoded {"type":2,"data":["update-value",{"value":20,"id":"34b96324.e02b4c"}],"nsp":"/"} as 2["update-value",{"value":20,"id":"34b96324.e02b4c"}] Wed, 29 Nov 2017 12:36:12 GMT socket.io-parser encoding packet {"type":2,"data":["update-value",{"value":false,"id":"c54c3c64.64e7e"}],"nsp":"/"} Wed, 29 Nov 2017 12:36:12 GMT socket.io-parser encoded {"type":2,"data":["update-value",{"value":false,"id":"c54c3c64.64e7e"}],"nsp":"/"} as 2["update-value",{"value":false,"id":"c54c3c64.64e7e"}] Wed, 29 Nov 2017 12:36:12 GMT socket.io-parser encoding packet {"type":2,"data":["update-value",{"value":false,"id":"c54c3c64.64e7e"}],"nsp":"/"} Wed, 29 Nov 2017 12:36:12 GMT socket.io-parser encoded {"type":2,"data":["update-value",{"value":false,"id":"c54c3c64.64e7e"}],"nsp":"/"} as 2["update-value",{"value":false,"id":"c54c3c64.64e7e"}] Wed, 29 Nov 2017 12:36:12 GMT socket.io-parser encoding packet {"type":2,"data":["update-value",{"value":false,"id":"c54c3c64.64e7e"}],"nsp":"/"} Wed, 29 Nov 2017 12:36:12 GMT socket.io-parser encoded {"type":2,"data":["update-value",{"value":false,"id":"c54c3c64.64e7e"}],"nsp":"/"} as 2["update-value",{"value":false,"id":"c54c3c64.64e7e"}]

---- 8< ---- snip a lot of lines....

[this is the end / line 5922ff] Wed, 29 Nov 2017 12:36:32 GMT socket.io-parser encoding packet {"type":2,"data":["update-value",{"value":true,"id":"c54c3c64.64e7e"}],"nsp":"/"} Wed, 29 Nov 2017 12:36:32 GMT socket.io-parser encoded {"type":2,"data":["update-value",{"value":true,"id":"c54c3c64.64e7e"}],"nsp":"/"} as 2["update-value",{"value":true,"id":"c54c3c64.64e7e"}] Wed, 29 Nov 2017 12:36:32 GMT socket.io-parser encoding packet {"type":2,"data":["update-value",{"value":true,"id":"c54c3c64.64e7e"}],"nsp":"/"} Wed, 29 Nov 2017 12:36:32 GMT socket.io-parser encoded {"type":2,"data":["update-value",{"value":true,"id":"c54c3c64.64e7e"}],"nsp":"/"} as 2["update-value",{"value":true,"id":"c54c3c64.64e7e"}] `

The dashboard item ist set into pass thru mode. So maybe this happends:

I try to disable pass thru in the json yet. Maybe this will make node to start again

volkerrichert commented 6 years ago

ok, in additional there was an error in my flow which results in multiple pass thur an the same red channel. But it seems to be a good idea to have a kind of protection

jdomeij commented 6 years ago

I have pushed out an new version that uses process.nextTick to prevent the stack overflow