mrgadget / node-red-contrib-eztimer

A simple-yet-flexible timer/scheduler for node-red
MIT License
13 stars 6 forks source link

eztimer crashes NPM when external set time is triggered #5

Closed WombatHollow closed 5 years ago

WombatHollow commented 5 years ago

A tigger time is set by input message, and displays correctly next to node, but when that time comes, NPM appears to stop...aka all flows stop and only fixed by Node-red-stop and node-red-start command. No errors reported in log or debug screen, but it takes over a minute to stop NR, and looking at the log it was unable to stop some process. The errors reported below.

Stopping Node-RED graphical event wiring tool...
nodered.service: State 'stop-sigterm' timed out. Killing.
nodered.service: Killing process 10213 (node-red) with signal SIGKILL.
nodered.service: Main process exited, code=killed, status=9/KILL
Stopped Node-RED graphical event wiring tool.
nodered.service: Unit entered failed state.
nodered.service: Failed with result 'timeout'.

The Node-red editor continues to work but if you try a deploy or commit, it also locks up. Dashboard also has ceased to work

Here is the eztimer configuration [{"id":"5506a524.00646c","type":"eztimer","z":"ea51febe.392e5","name":"","autoname":"17:00","suspended":false,"sendEventsOnSuspend":false,"lat":"-35.31","lon":"149.68","timerType":"2","startupMessage":false,"ontype":"2","ontimesun":"sunsetStart","ontimetod":"17:00","onproperty":"payload","onvaluetype":"str","onvalue":"true","onoffset":"-2","onrandomoffset":0,"offtype":"9","offtimesun":"dusk","offtimetod":"dusk","offduration":"500","offproperty":"payload","offvaluetype":"str","offvalue":"false","offoffset":0,"offrandomoffset":true,"mon":true,"tue":true,"wed":true,"thu":true,"fri":true,"sat":true,"sun":true,"x":630,"y":240,"wires":[["6e5f5853.c14378","543b1a39.2a9ff4","84696923.eeb0d8"]]}]

And here is the input message used to set trigger time

{"_msgid":"50379394.154d0c","topic":"","payload":{"ontime":"16:45","Zone":{"Number":0,"Name":"Spare","Description":"Spare outlet on Vege Patch Solinoids for solinoid switched hose","FlowRate":20,"Area":10,"Enable":"Off","Fixed":{"Duration":60,"Period":2},"Evap":{"Defined ":false},"DayLastWatered":17960}},"thisZone":0,"Today":17971}

mrgadget commented 5 years ago

Odd - thanks for the report, I'll chuck this in a flow and see if I can reproduce.

mrgadget commented 5 years ago

Hi - I can't reproduce your error sorry. I imported your node, and crafted an inject node with your payload. Here's the flow, with the server log overlaid, and the debug showing the message being sent at the correct time, and no errors in the server log.

image

One thought - are you using the latest version? I updated it about 11 days ago with some bugfixes.

Here's the flow I used if you'd like to check it in your install - [{"id":"10e073c9.32604c","type":"eztimer","z":"ed59d796.5e0c48","name":"","autoname":"17:00","suspended":false,"sendEventsOnSuspend":false,"lat":"-35.31","lon":"149.68","timerType":"2","startupMessage":false,"ontype":"2","ontimesun":"sunsetStart","ontimetod":"17:00","onproperty":"payload","onvaluetype":"str","onvalue":"true","onoffset":"-2","onrandomoffset":0,"offtype":"9","offtimesun":"dusk","offtimetod":"dusk","offduration":"500","offproperty":"payload","offvaluetype":"str","offvalue":"false","offoffset":0,"offrandomoffset":true,"mon":true,"tue":true,"wed":true,"thu":true,"fri":true,"sat":true,"sun":true,"x":320,"y":75,"wires":[["67394842.acd948"]]},{"id":"d440ea84.47f1b8","type":"inject","z":"ed59d796.5e0c48","name":"","topic":"","payload":"{\"ontime\":\"19:55\",\"Zone\":{\"Number\":0,\"Name\":\"Spare\",\"Description\":\"Spare outlet on Vege Patch Solinoids for solinoid switched hose\",\"FlowRate\":20,\"Area\":10,\"Enable\":\"Off\",\"Fixed\":{\"Duration\":60,\"Period\":2},\"Evap\":{\"Defined \":false},\"DayLastWatered\":17960}}","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":125,"y":75,"wires":[["10e073c9.32604c"]]},{"id":"67394842.acd948","type":"debug","z":"ed59d796.5e0c48","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":515,"y":75,"wires":[]}]

mrgadget commented 5 years ago

I just re-read your initial message and note that you didn’t see anything in your log either. I was able to commit changes and other things still triggered fine after the test event.

WombatHollow commented 5 years ago

Confirmed I have v1.0.6 of eztrigger (from Node-red site). I also made a debug version, no issue, copied part of my flow to the Debug tab, again no issue. It appears that because I got no debug message out of eztrigger, I assume all stopped in eztrigger, but the fault was further in the flow, it was crashing before the debug message from eztrigger was being displayed. aka wrong assumption. In debugging the error has gone away so I assume it may have been something in the message (I have only tweaked payload to delete redundant data after eztrigger) cause a later node to crash, but never got to the bottom of that one.

So thanks for your help and sorry to have wasted your time, I think this is is a non issue for eztrigger node so can be closed.

One question, I had hoped sending a event into the node with payload of "on" would have triggered the event in the eztrigger queue with the pending events payload, instead it only sends an payload of "on". was this as intended or is there a way to trigger a pending trigger with a input message. Thanks

mrgadget commented 5 years ago

No problem - like the ones I can close easily! Odd your last paragraph though - how you would like it to behave it is how it behaves for me. Using basically the same test flow as above, but this time I send a string on as the payload. That message is discarded within eztimer and it then emits the pre-defined on payload.

image

Flow as above (for you to test): [{"id":"ed59d796.5e0c48","type":"tab","label":"Flow 2","disabled":false,"info":""},{"id":"10e073c9.32604c","type":"eztimer","z":"ed59d796.5e0c48","name":"","autoname":"17:00","suspended":false,"sendEventsOnSuspend":false,"lat":"-35.31","lon":"149.68","timerType":"2","startupMessage":false,"ontype":"2","ontimesun":"sunsetStart","ontimetod":"17:00","onproperty":"payload","onvaluetype":"str","onvalue":"this is the payload - a string","onoffset":"-2","onrandomoffset":0,"offtype":"9","offtimesun":"dusk","offtimetod":"dusk","offduration":"500","offproperty":"payload","offvaluetype":"str","offvalue":"false","offoffset":0,"offrandomoffset":true,"mon":true,"tue":true,"wed":true,"thu":true,"fri":true,"sat":true,"sun":true,"x":320,"y":75,"wires":[["67394842.acd948"]]},{"id":"d440ea84.47f1b8","type":"inject","z":"ed59d796.5e0c48","name":"","topic":"","payload":"on","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":125,"y":75,"wires":[["10e073c9.32604c"]]},{"id":"67394842.acd948","type":"debug","z":"ed59d796.5e0c48","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":515,"y":75,"wires":[]}]