Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

node stops at midnight #28

Closed
Iceteax opened this issue Nov 4, 2020 · 13 comments
Closed

node stops at midnight #28

Iceteax opened this issue Nov 4, 2020 · 13 comments

Comments

@Iceteax
Copy link

Iceteax commented Nov 4, 2020

Hi!

Since updating to version 1.3.0 my cron timer stop at midnight. Unfortunately, I cannot remember from which version I updated...

The example below worked until the update. The status bar shows that the node will be only executed at the next midnight instead of every 5 minutes. When I edit this note and deploy it, it works as expected until midnight and then stops again.

image

image

BTW: Cron nodes I set to a specific time once a day, week or month obviously seem to work. Is there anything I missed?

@Steve-Mcl
Copy link
Owner

That is most strange.

Could you screenshot the tooltip for the cron expression and also export that node and paste in a reply

```
like this
```

@Iceteax
Copy link
Author

Iceteax commented Nov 4, 2020

Yes, sure! I think, for the screenshot I have to wait until tomorrow morning as I have already reactivated the node for today.
So, for today it looks ok:
image

The node should not change so here is the export:

[{"id":"ab74c5c9.10b218","type":"cronplus","z":"d55ece55.0b56f8","name":"Alle 5 Minuten","outputField":"payload","timeZone":"Europe/Berlin","persistDynamic":false,"commandResponseMsgOutput":"output1","outputs":1,"options":[{"name":"Alle 5 Minuten","topic":"Alle 5 Minuten","payloadType":"default","payload":"","expressionType":"cron","expression":"0 */5 * * * *","location":"","offset":"0","solarType":"all","solarEvents":"sunrise,sunset"}],"x":140,"y":4400,"wires":[["74a010b5.3115e8"]]}]

I just compared this export of an existing node with an export of a new cron node but there is no difference at all.

@Iceteax
Copy link
Author

Iceteax commented Nov 5, 2020

As promised the updated screenshot from today. Seems to be fine, but does not execute at those times.

image

Have you seen anything strange or do you think it might be a good idea to delete all existing cron nodes, delete the node from the palette and reinstall it?

Edit: I just found a testnode which survived midnight. This node is without any custom texts and the cron syntax is a bit different.
image

[{"id":"be7dfbfd.70cb28","type":"cronplus","z":"d55ece55.0b56f8","name":"","outputField":"payload","timeZone":"","persistDynamic":false,"commandResponseMsgOutput":"output1","outputs":1,"options":[{"name":"schedule1","topic":"schedule1","payloadType":"default","payload":"","expressionType":"cron","expression":"0 0/5 * * * ? *","location":"","offset":"0","solarType":"all","solarEvents":"sunrise,sunset"}],"x":500,"y":4740,"wires":[[]]}]

@Steve-Mcl
Copy link
Owner

Steve-Mcl commented Nov 5, 2020

Good morning.

As promised the updated screenshot from today. Seems to be fine, but does not execute at those times.

When the cron-node is stopped, could you inject into it, a topic of "status-all" and capture the complete message (using a debug on the output of CRON set to show complete message) by using the copy button that appears under your mouse cursor when you hover over the debug message? It might provide some clues.


NOTE: I myself setup a test as I am concerned there is a bug. Unfortunately (or from my perspective fortunately) it worked as expected. I set up logging yesterday on the IMPORTED node you sent, like this: CRON(0 */5 * * * *) --> FLOGGER

image

It was 100% correct...
image


Edit: I just found a testnode which survived midnight. This node is without any custom texts and the cron syntax is a bit different.

The syntax difference should make no difference and as shown above, using 0 */5 * * * * my test worked.


I am struggling to think of what could be upsetting your system.

Do you do any dynamic control (i.e. send control messages to stop or pause) any of the CRON nodes in your flow?

@Iceteax
Copy link
Author

Iceteax commented Nov 5, 2020

Good morning,

When the cron-node is stopped, could you inject into it, a topic of "status-all" and capture the complete message

Sure, here is the output:
{"_msgid":"6f05d510.1f8aac","topic":"status-all","payload":{"command":{"command":"status-all"},"result":[{"config":{"topic":"Alle 5 Minuten","name":"Alle 5 Minuten","payloadType":"default","payload":"payload","limit":null,"expressionType":"cron","expression":"0 */5 * * * *","isDynamic":false,"modified":false},"status":{"type":"static","modified":false,"isRunning":true,"count":118,"limit":0,"nextDescription":"in 1 minute 26 seconds","nextDate":"2020-11-05T08:25:00.000Z","nextDateTZ":"Nov 05, 2020, 09:25:00 GMT+1","timeZone":"Europe/Berlin","serverTime":"2020-11-05T08:23:33.374Z","serverTimeZone":"CET","description":"Every 5 minutes"}}]},"commandResponse":true}

NOTE: I myself setup a test as I am concerned there is a bug. Unfortunately (or from my perspective fortunately) it worked as expected. I set up logging yesterday on the IMPORTED node you sent, like this: CRON(0 */5 * * * *) --> FLOGGER

Thank you! As noone else mentioned such a behaviour it must have to do something with the system (or a very specific setting noone else uses, which I doubt to be honest). I think I will add flogger as well. Maybe I get an useful information next night or a more specific information when exactly the cron job stops working.

I am struggling to think of what could be upsetting your system.

Yeah, I can image that. I have added some cron nodes with different context this morning based on the one which survived the daychange. I try to find out if there might be a connection to a specific setting although I have no idea which might be the problem.

Do you do any dynamic control (i.e. send control messages to stop or pause) any of the CRON nodes in your flow?

Let's see. Yes, I have. Not in the same flow but on a different one. Let me explain, what I have set up.

Static:
I have 12 cron nodes at my "Trigger" flow without any input. 5 of them (should) do a continious execution every minute, 5min, 10 min, 15min, 60 min. Those are faulty the next morning. The rest is configured to be run once a day, week, month, year. According to the status, these are good to go.

Dynamic:
On another flow I have a cron node (every 20s) which is dynamically started (start-all) and stopped (stop-all) depending on the window status of the house. As all windows are closed at night, this should have no impact at this time. Testing this idea right now does not have any impact on the other cron nodes. Yeah, I think the Flogger node makes sense.

Finally: On another flow I create a dynamic (persisting) schedule. But this only works if one other computer is powered on which is not at night. A powered off computer does not execute the function to set the schedule. Status seems to be ok. No start stop here, this schedule is a fixed DateTime.

@Iceteax
Copy link
Author

Iceteax commented Nov 6, 2020

Alright, the last call of the cron job is indeed at midnight. The next call at 00:05 is not executed any more.

As I mentioned yesterday, I have added several nodes with different settings. I might have an idea now what is going wrong:

All nodes stopped at midnight where I set the time zone to “Europe\Berlin”.
All nodes are still running where no time zone is set. I just checked my rPis settings and the time zone is already set to “Europe\Berlin”.

So, it seems that the fix will be quite easy for me: I will remove the time zone from all nodes and have another look tomorrow.

I guess you are not in the same time zone like me, so maybe the problem is reproducible at your side when the node is set to exactly the same time zone set in the system?

I have set up another node with a different time zone (Europe \London) now. If am right, the London trigger will work tomorrow, the Berlin trigger will be stopped.

@Iceteax
Copy link
Author

Iceteax commented Nov 7, 2020

Hmm, obviously my guess was wrong. Both timer, Berlin and London, stopped at midnight resp. 1am.
image

Well, all my cron nodes in which I deleted the time zone work again. So, if you like, feel free to close the topic. If you want me to check other thinks, feel free to contact me.

Thank you for your time and work.

@Steve-Mcl
Copy link
Owner

Hi, thanks for taking the time to raise the issue and help me out.

I'll leave this open for now and see if I can't figure this out with the clues you have provided.

Oh, one last thing, you machine isn't going to sleep is it?

@Iceteax
Copy link
Author

Iceteax commented Nov 7, 2020

No, this raspberry is used for my smart home control, so sleeping is not allowed at all. I think, if a sleep would happen, not only those nodes with a time zone set would be stopped but all.

@Steve-Mcl
Copy link
Owner

Hi @Iceteax I have had several Cron nodes (with and without timezone) running for a few days. I cannot reproduce your issue :(

I really would like to fix this if I can.

Perhaps you could share your flows (only need the cron nodes and any dynamic control parts)

@Iceteax
Copy link
Author

Iceteax commented Nov 11, 2020

Hi @Steve-Mcl ,

I have the impression that this is somehow only related to my system. Don't waste too much time on it, but I really appreciate it that you do!

I have simplified the flows with the dynamic cron nodes.
The first is a simple start-stop flow.
The second one sends an array of timestamps to the node. The array is based on a csv file, which is transformed into an array somewhere before the function included. The control part is at the very bottom of the function.

All in all I don't think that these two nodes can have any effect on the other cron triggers, especially since they all work since I removed the timezone.

[{"id":"c93cb50b.0dc818","type":"tab","label":"Flow 1","disabled":false,"info":""},{"id":"1694adf.a257b52","type":"inject","z":"c93cb50b.0dc818","name":"","repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"1","payloadType":"num","x":130,"y":80,"wires":[["ccdad68c.079df8"]]},{"id":"8859e488.2fd758","type":"inject","z":"c93cb50b.0dc818","name":"","repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"0","payloadType":"num","x":130,"y":160,"wires":[["ac7bf1d2.45476"]]},{"id":"ccdad68c.079df8","type":"change","z":"c93cb50b.0dc818","name":"","rules":[{"t":"set","p":"topic","pt":"msg","to":"start-all","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":370,"y":80,"wires":[["38bb7cb0.fc1ba4"]]},{"id":"ac7bf1d2.45476","type":"change","z":"c93cb50b.0dc818","name":"Stop","rules":[{"t":"set","p":"topic","pt":"msg","to":"stop-all","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":510,"y":160,"wires":[["38bb7cb0.fc1ba4"]]},{"id":"38bb7cb0.fc1ba4","type":"cronplus","z":"c93cb50b.0dc818","name":"20 Sekunden","outputField":"payload","timeZone":"","persistDynamic":false,"commandResponseMsgOutput":"output1","outputs":1,"options":[{"name":"Alle 20 Sekunden","topic":"20sec","payloadType":"default","payload":"","expressionType":"cron","expression":"*/20 * * * * * *","location":"","offset":"0","solarType":"all","solarEvents":"sunrise,sunset"}],"x":550,"y":80,"wires":[["cc52c185.9be35"]]},{"id":"cc52c185.9be35","type":"debug","z":"c93cb50b.0dc818","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":790,"y":80,"wires":[]},{"id":"f8433bda.cd90e8","type":"function","z":"c93cb50b.0dc818","name":"","func":"var itemList = msg.payload; // items as array\nitemList = itemList.reverse();\nvar cronArray = [];\nvar ebayArray = flow.get(\"eBayArray\");\nvar isDebug = false;\n\n//iterates through itemarray\nfor(i=0;i<itemList.length;i++)\n{\n //If column with a date exists =>\n if(itemList[i].col2 !== undefined)\n {\n var endDate = itemList[i].col2;\n endDate = endDate.replace(/#/g,''); //Deletes # \n endDate = endDate+\" GMT\";\n\n tsEndDate = Date.parse(endDate);\n if(Date.now()<tsEndDate)\n {\n tsEndDate = tsEndDate - 300000; //found timestamp minus 5 minutes (300.000 ms)\n cronArray.push(tsEndDate);\n }\n }\n}\n\n// Compare ebayArray and cronArray\nresult = ebayArray.length === cronArray.length && ebayArray.sort().every(function(value, index) { return value === cronArray.sort()[index]});\nif(isDebug) node.warn(\"Item list is same like before: \"+result);\n\nif(!result)\n{\n if(isDebug) node.warn(cronArray);\n msg.payload = {\n \"command\": \"add\",\n \"name\": \"ebay\",\n \"expression\": cronArray,\n \"expressionType\": \"dates\",\n \"payloadType\": \"default\"\n }\n flow.set(\"eBayArray\",cronArray)\n return msg;\n}","outputs":1,"noerr":0,"initialize":"","finalize":"","x":100,"y":320,"wires":[["99bcfc2d.37d82"]]},{"id":"99bcfc2d.37d82","type":"cronplus","z":"c93cb50b.0dc818","name":"","outputField":"payload","timeZone":"","persistDynamic":true,"commandResponseMsgOutput":"output1","outputs":1,"options":[],"x":240,"y":320,"wires":[["d7707eba.4d4e2"]]},{"id":"6b31a8fd.e4bfd8","type":"comment","z":"c93cb50b.0dc818","name":"A csv file is fetched from another computer, parsed...","info":"... converted into an array and the function does some datetime calculation, cleans things up and at the end the function pushes an array of timestamps to the cron node if needed.","x":210,"y":260,"wires":[]},{"id":"c905d927.689318","type":"comment","z":"c93cb50b.0dc818","name":"Simplified dynamic cron","info":"","x":120,"y":20,"wires":[]},{"id":"d7707eba.4d4e2","type":"debug","z":"c93cb50b.0dc818","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":390,"y":320,"wires":[]}]

@Steve-Mcl
Copy link
Owner

Hi @Iceteax unfortunately, in all my tests i cannot re-produce your issue.

I will close this issue for now but feel free to re-open if necessary.

Thanks for your feedback.

@Iceteax
Copy link
Author

Iceteax commented Nov 19, 2020

No problem. The workaround fits for me. Thank you for your time!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants