btreinders Posted January 17, 2020 Posted January 17, 2020 @Michel Kohanim Is there a command from a telent session to stop program execution? I had a program that uses a += that apparently has caused an infinite loop. Thanks!
larryllix Posted January 18, 2020 Posted January 18, 2020 1 hour ago, btreinders said: @Michel Kohanim Is there a command from a telent session to stop program execution? I had a program that uses a += that apparently has caused an infinite loop. Thanks! Just log in normally and stop the offending program. You will have to wait every step for ISY to catch up but it will service your requests eventually.
btreinders Posted January 18, 2020 Author Posted January 18, 2020 I waited over a half hour and the console would not respond. I rebooted it and never got back into the console. Even telneting was locking up intermittently, like no response from the prompt sometimes. Finally gave up and tried FR from telnet which didn't work. Had to hard reset to fix it.
Michel Kohanim Posted January 19, 2020 Posted January 19, 2020 @btreinders, Unfortunately not. I suspect you have an infinite loop. If you have ISY994i (not ISY994i ZW+), unplugging the PLM puts ISY in safe mode and no programs will run. With kind regards, Michel 2
btreinders Posted January 20, 2020 Author Posted January 20, 2020 @Michel Kohanim I do have Zwave but i added it to the ISY so I do have a PLM. I assume that will stop executing with the PLM unplugged or does just having Zwave let it execute with it unplugged? I definitely had an issue but I am not sure why. Under the else of a program I set a variable += to a node server rain today value and then to test it I ran the else. That is when it stopped responding. Even after a reboot it would not respond. Thanks!
Michel Kohanim Posted January 20, 2020 Posted January 20, 2020 @btreinders, Do you have a good backup? With kind regards, Michel
btreinders Posted January 20, 2020 Author Posted January 20, 2020 @Michel Kohanim Yes, and I used it to get things back but was just wondering why it happened in the first place. Setting a += for a node server value shouldn't cause that should it?
DaveStLou Posted January 21, 2020 Posted January 21, 2020 On 1/19/2020 at 4:02 PM, Michel Kohanim said: I suspect you have an infinite loop. Lesson I learned from someone else on the forum after experiencing more than one of these (for different reasons) - I have a state variable called "s.Programs.Run" that is normally set to 1 that I use as a kill switch. I've set it as a condition at the top of My Program folder. When things go bad, I can usually eventually get it to stop by changing the variable to 0 through Agave. Alternately, a spare switch or other device could be used to trigger a program that sets the variable to 0. 2
btreinders Posted January 24, 2020 Author Posted January 24, 2020 On 1/20/2020 at 10:48 AM, btreinders said: @Michel Kohanim Yes, and I used it to get things back but was just wondering why it happened in the first place. Setting a += for a node server value shouldn't cause that should it? @Michel Kohanim Any ideas why this caused an infinite loop? @DaveStLou Thanks! I will definitely implement this! 1
Michel Kohanim Posted January 24, 2020 Posted January 24, 2020 @btreinders, I have no clue without looking at your program. With kind regards, Michel
btreinders Posted January 25, 2020 Author Posted January 25, 2020 @Michel Kohanim Precip Today - [ID 04A3][Parent 03E0] If 'OpenWeatherMap / OpenWeatherMap' Rain Today is not '$PRECIP_TODAY Inches' And 'OpenWeatherMap / OpenWeatherMap' Rain Today > '$PRECIP_TODAY Inches' Then $PRECIP_TODAY = 'OpenWeatherMap / OpenWeatherMap' Rain Today Inches Else $PRECIP_TODAY += 'OpenWeatherMap / OpenWeatherMap' Rain Today Inches
kclenden Posted January 26, 2020 Posted January 26, 2020 (edited) On 1/24/2020 at 7:51 AM, btreinders said: Any ideas why this caused an infinite loop? Is $PRECIP_TODAY defined as an integer or state variable? If it's defined as a state variable then every time you change the value of $PRECIP_TODAY, as you do in the THEN and ELSE, the IF of the program will be reevaluated. So what likely happened is: You executed the ELSE. This caused the value of 'OpenWeatherMap / OpenWeatherMap' Rain to be added to $PRECIP_TODAY Since the ELSE changed the value of $PRECIP_TODAY, the IF was reevaluated which caused the ELSE to run again (back to step 1) When you rebooted the ISY, the value of $PRECIP_TODAY would return to 0 and thus 'OpenWeatherMap / OpenWeatherMap' Rain would likely be greater than $PRECIP_TODAY and thus the THEN would execute. When the THEN executes, it changes the value of $PRECIP_TODAY so the IF would be reevaluated and then the ELSE would run and you're back in the two step infinite loop above. Edit to add: The difference between your THEN and ELSE is that the THEN always assigns the value of 'OpenWeatherMap / OpenWeatherMap' Rain to $PRECIP_TODAY while the ELSE increments the value of $PRECIP_TODAY by the value of 'OpenWeatherMap / OpenWeatherMap' Rain. As far as the ISY is concerned, if you execute a statement that assigns a value to a variable that is the same as the value already held by the variable, then the variable has not changed. So the first time the THEN assigns 'OpenWeatherMap / OpenWeatherMap' Rain to $PRECIP_TODAY it causes the IF to reevaluted, but a second assignment of 'OpenWeatherMap / OpenWeatherMap' Rain would not change the value of $PRECIP_TODAY and the IF would not be reevaluated. So there's no chance the THEN will cause an infinite loop (unless 'OpenWeatherMap / OpenWeatherMap' Rain is constantly changing). But the ELSE is always adding to the value of $PRECIP_TODAY so it always causes the IF to be reevaluated and thus causes the infinite loop. Edited January 26, 2020 by kclenden 1
btreinders Posted January 26, 2020 Author Posted January 26, 2020 @kclenden Wow, I feel very stupid! I should have caught that. Thanks for the info! I really appreciate all the help in these forums! 1
Recommended Posts