node-red / node-red-nodes

Extra nodes for Node-RED
Other
992 stars 594 forks source link

Intermittent error with WOL node #83

Closed natcl closed 9 years ago

natcl commented 9 years ago

I have an intermittent bug when trying to wake several computers at the same time, here is the output I get:

18 Nov 11:53:29 - [red] Uncaught Exception:
18 Nov 11:53:29 - Error: Not running
    at Socket._healthCheck (dgram.js:420:11)
    at Socket.close (dgram.js:327:8)
    at Object.post_write [as cb] (/home/pi/node-red/node_modules/wake_on_lan/wake_on_lan.js:54:14)
    at Object.afterSend [as oncomplete] (dgram.js:322:9)
knolleary commented 9 years ago

Hi, is there a reason you've raised this on the node-red-nodes repository? Do you think this is related to one of the nodes in this repository?

Can you also provide any more context, such as what nodes you're using in your flows, what version of node-red, version of node etc.

natcl commented 9 years ago

Oops sorry I thought this was a separate repository specific to the wake on lan node. This is with node 0.9.1 and the latest version of the node-red-nodes repo.

Here are the nodes :

[{"id":"9630f981.69cf08","type":"wake on lan","mac":"C8:60:00:E9:42:06","name":"Macy's","x":481,"y":147,"z":"17165199.e8e9ae","wires":[]},{"id":"44ed5efe.bb12a","type":"wake on lan","mac":"30:85:A9:A4:4F:C1","name":"Sagrada","x":485,"y":188,"z":"17165199.e8e9ae","wires":[]},{"id":"ef576cb9.10a89","type":"wake on lan","mac":"60:A4:4C:22:11:85","name":"Mandalay Bay","x":505,"y":226,"z":"17165199.e8e9ae","wires":[]},{"id":"ec6a83dc.13958","type":"wake on lan","mac":"60:A4:4C:E8:2F:9E","name":"Oakley","x":479,"y":101,"z":"17165199.e8e9ae","wires":[]},{"id":"50e8c802.af1738","type":"inject","name":"","topic":"","payload":"","payloadType":"none","repeat":"","crontab":"","once":false,"x":198,"y":115,"z":"17165199.e8e9ae","wires":[["ec6a83dc.13958","9630f981.69cf08","44ed5efe.bb12a","ef576cb9.10a89"]]}]
natcl commented 9 years ago

Just noticed my first paste did not work properly, here's the good error:

18 Nov 11:53:29 - [red] Uncaught Exception:
18 Nov 11:53:29 - Error: Not running
    at Socket._healthCheck (dgram.js:420:11)
    at Socket.close (dgram.js:327:8)
    at Object.post_write [as cb] (/home/pi/node-red/node_modules/wake_on_lan/wake_on_lan.js:54:14)
    at Object.afterSend [as oncomplete] (dgram.js:322:9)
dceejay commented 9 years ago

Hi - how often does this occur ? What hardware is this on ? I've tried adding extra target macs and hitting it 20 times a sec and I can't get it to fail (yet).

natcl commented 9 years ago

It's on a Raspberry pi. It's been pretty erratic, I had it work fine for a couple of days. Then started having some problems yesterday. The script also has some exec nodes firing at the same time, maybe it's related ? Here's the full node:

[{"id":"9fae20b6.6051e","type":"wake on lan","mac":"C8:60:00:E9:42:06","name":"Macy's","x":444,"y":157,"z":"3ded94a6.c2126c","wires":[]},{"id":"cb6ca32d.34936","type":"wake on lan","mac":"30:85:A9:A4:4F:C1","name":"Sagrada","x":448,"y":198,"z":"3ded94a6.c2126c","wires":[]},{"id":"19507218.e6af8e","type":"wake on lan","mac":"60:A4:4C:22:11:85","name":"Mandalay Bay","x":468,"y":236,"z":"3ded94a6.c2126c","wires":[]},{"id":"18b3214.fe74cdf","type":"wake on lan","mac":"60:A4:4C:E8:2F:9E","name":"Oakley","x":442,"y":111,"z":"3ded94a6.c2126c","wires":[]},{"id":"c3124c63.3cedb","type":"exec","command":"ssh mofa@TimeTower-Mac-mini.local \"caffeinate -u -t 1\"","append":"","useSpawn":"","name":"Wake TimeTower","x":335,"y":350,"z":"3ded94a6.c2126c","wires":[["4ed291fc.b12d7"],["4ed291fc.b12d7"],["4ed291fc.b12d7"]]},{"id":"a0745a4d.5f8ba8","type":"exec","command":"ssh mfe134@mfe-134.local \"caffeinate -u -t 1\"","append":"","useSpawn":"","name":"Wake Atlantic","x":325,"y":405,"z":"3ded94a6.c2126c","wires":[["d553d256.2aac3"],["d553d256.2aac3"],["d553d256.2aac3"]]},{"id":"4ed291fc.b12d7","type":"debug","name":"WakeTimeTower","active":true,"console":"false","complete":"payload","x":600,"y":345,"z":"3ded94a6.c2126c","wires":[]},{"id":"d553d256.2aac3","type":"debug","name":"WakeAtlantic","active":true,"console":"false","complete":"payload","x":585,"y":416,"z":"3ded94a6.c2126c","wires":[]},{"id":"eb022b2d.14fdd8","type":"inject","name":"","topic":"","payload":"","payloadType":"none","repeat":"","crontab":"","once":false,"x":161,"y":125,"z":"3ded94a6.c2126c","wires":[["18b3214.fe74cdf","9fae20b6.6051e","cb6ca32d.34936","19507218.e6af8e","c3124c63.3cedb","a0745a4d.5f8ba8"]]}]
dceejay commented 9 years ago

Have pushed a small update to the repo (not npm yet) - that adds a try catch around the call - but it may not catch it :-).... Have also asked the upstream package owner to see if he will update his module to check for the socket's existence before trying to close it. (I think occasionally we must be getting overlapping requests - and one is closing it before the other has finished using it so the second then fails to close it.

Will leave open for you to report back, and to remember to check upstream.

natcl commented 9 years ago

Great thanks, leaving link to upstream issue here for reference: https://github.com/agnat/node_wake_on_lan/issues/2

dceejay commented 9 years ago

OK - he's fixed it upstream... needs his latest from npm 0.0.4 I leave the try/catch in for now. See how it goes. I'll push to npm when we are happy.

natcl commented 9 years ago

Thanks ! Will test !

dceejay commented 9 years ago

Hi @natcl - any signs of continued failure ? Can we close this issue ?

dceejay commented 9 years ago

Closing this issue as I think it's now fixed... please re-open if not.