Jump to content

Stop Program Execution From Telnet


btreinders

Recommended Posts

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.

Link to comment

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.

Link to comment

@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!

Link to comment
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.

image.png.6f3285cbd0ae4c5106fcd2a7985def12.png

Link to comment

@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
 

Link to comment
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:

  1. You executed the ELSE.  This caused the value of 'OpenWeatherMap / OpenWeatherMap' Rain to be added to $PRECIP_TODAY
  2. 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.

Link to comment

Archived

This topic is now archived and is closed to further replies.


×
×
  • Create New...