monteslu / node-red-contrib-gpio

A set of node-red nodes for connecting to johnny-five IO Plugins
MIT License
41 stars 31 forks source link

Does a redeploy "cleanup" previous deploys? #20

Open nkolban opened 8 years ago

nkolban commented 8 years ago

I am using Node-RED 0.14.6 with Node.js 4.4.7. When I deploy a flow that contains a "Johnny5" node, all works well. If I change my logic and re-deploy, it is as though the previous deployment is still active concurrently with the new deployment. Does a redeployment cause the "cleanup" of previous deployments? When I stop Node-RED and restart it, all works again as desired until the next redeploy.

monteslu commented 8 years ago

So, there's quite a bit of hackery in this...

For pagenodes I can run johnny-five in a webworker and just dump the webworker on redeploy: https://github.com/monteslu/pagenodes/blob/master/src/red/nodes/nodeDefs/io/lib/nodebotNode.js#L168 Works like a champ.

For node-red i have to try and clean up after myself since the same javascript VM persists. What this means is that I try clearing intervals and disconnecting things: https://github.com/monteslu/node-red-contrib-gpio/blob/master/lib/nodebotNode.js#L43-L99

The problem with my node-red method of cleaning up is I might be leaving stuff out there that my own testing hasn't noticed.

I cant try and reproduce your specific error if you want to share some code from the johnny5 node you're deploying.

A better long term solution might be to use node's clustering mechanism to spawn a thread for each connected nodebot. I need to investing this some more.

nkolban commented 8 years ago

Here is an attachment including my exported flow: flow.txt

I also produced a video on using the "Johnny5" node:

https://www.youtube.com/watch?v=zy-uMLru7fQ

This doesn't illustrate the problem, but does show the example flow. If I change the flow and redeploy, pressing the button shows the debug happening as many times as I have redeployed.

Ib2cool commented 5 years ago

This is still an issue: "button shows the debug happening as many times as I have redeployed" This is reproduce-able with "gpio in" wired to debug node and with "Johnny5" node wired to debug node Any fix for this?