Jump to content
C4 Forums | Control4
  • 0

How to stop a endless loop running on controller?


jfh

Question

My HC-800 is running code that results in an endless loop.  I have rebooted the controller, but when it comes up it is apparently executing the same loop and  the controller gets bogged down very quickly.

 

How can I stop the controller from executing whatever commands are correntlly n the queue?   I know where the offending code is.  I want to keep the controller long enough to make the code change and then have the controller start up without running whatever commands are queued up.

 

Dont want to restore a backup unless it is the last resort because I made a lot of changes today.

 

is there a process I can kill that stop the project from running but that would still let me edit in Composer?

Link to comment
Share on other sites

18 answers to this question

Recommended Posts

Everything back to normal and have a current backup. :)

 

C4 should put a "kill" option in HE somewhere.   I realized my code was going to loop just as I hit the button ...  I was just surprised power cycling the controller would just pick up where it left off instead of starting fresh.

 

Anyone know the reasoning behind not clearing the execution queue on a clean boot?  I can't think of why you would want the controller NOT to start fresh in that case.  @RyanE can you weigh in?

Link to comment
Share on other sites


3 hours ago, msgreenf said:

It does clear the queue on reboot but whatever the condition you triggered in programming was met

 

It sure didn't seem to clear until the code was deleted.  The loop was caused by trying to reset an experience button:

 

When Favorite - Type 1 Kitchen->NPR has been switched off
     Turn off Kitchen

 

When Kitchen -> the room turns off
     Select Favorite - Type 1 Kitchen -> NPR has been switched off

 

 The controller didn't stop looping after the code executed the first time until I deleted the second line of code within about 30 seconds after a reboot and then hard booted again.  (So, after the first reboot the code loop was still running)

Link to comment
Share on other sites

10 hours ago, RyanE said:

 

Something (I can't say what) was triggering your code on the clean boot, as Director does not persist it's programming queue over a restart.

 

 

Thanks for the additional info and clarification.

Link to comment
Share on other sites

13 minutes ago, lippavisual said:

Personally, I've never used loops in the 11 years of my dealership, so experience is limited as to how they act.

I don't think the poster is using loops, they just have 2 sets of programming that trigger each other.

Which is a loop, without the 'loop' programming construct.

RyanE

 

Link to comment
Share on other sites

12 hours ago, jfh said:

C4 should put a "kill" option in HE somewhere.   I realized my code was going to loop just as I hit the button ...  I was just surprised power cycling the controller would just pick up where it left off instead of starting fresh.

Anyone know the reasoning behind not clearing the execution queue on a clean boot?  I can't think of why you would want the controller NOT to start fresh in that case.  @RyanE can you weigh in?

As director is single-threaded, once it's in a loop, there's no way to kill it without killing the Director process, since Director isn't communicating to ComposerPro (or HE, for that matter) at that point.

There's also no way for Director to programmatically determine in advance if a loop will happen in programming, due to the Halting Problem: 

https://en.wikipedia.org/wiki/Halting_problem

Something (I can't say what) was triggering your code on the clean boot, as Director does not persist it's programming queue over a restart.

RyanE

 

Link to comment
Share on other sites

Technically, it is a software forced off at reboot.  Director doesn't "remember" if a room was ON/OFF after it reboots.  So you can still have equipment on, ie: TV's displaying a cable box, etc.  But if you then pick up a remote, TS, app, the room shows the off state and must be turned on again.

Whether or not that correlates to your programming, that is what happens when director reboots.

Personally, I've never used loops in the 11 years of my dealership, so experience is limited as to how they act.

Link to comment
Share on other sites

8 minutes ago, lippavisual said:

When director is rebooted, all rooms are considered to be off, even if it was on before reboot.

Ok, but if the Kitchen is considered off at reboot, why would the "when Kitchen turns off" code run since the kitchen is already off?  Or is control 4 actually doing a forced room off state change for every room at reboot?

Link to comment
Share on other sites

I would edit in virtual if I had Pro, but all I have is HE.

 

i was able to get in immediately after a reboot, delete the offending code and save a backup so I'm hoping all is ok after a reboot.

if not, I can clear the project and load the backup I just took.

 

Link to comment
Share on other sites

33 minutes ago, annex⁴ said:

Shut down Director, SSH in to the controller, delete or modify driver, start Director and hope you solved the problem.

Thanks.  It's not a driver that's causing the problem, just event programming.  If I shutdown director, will Composer still access / be able to update the project?

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.