HISE Logo Forum
    • Categories
    • Register
    • Login

    TimerObject execution time-out error

    Scheduled Pinned Locked Moved General Questions
    18 Posts 4 Posters 798 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • ustkU
      ustk
      last edited by

      Often, I get an execution time-out error at init with this code:

      const var myTimer = Engine.createTimerObject();
      
      myTimer.setTimerCallback(function()
      {
          myTimer.stopTimer();    // Execution time-out error on this line
      
          // Some code
      
          myTimer.startTimer(30);
      });
      myTimer.startTimer(30);
      

      So I get the error where I stop the timer...
      The code in between is only animations and reading values (other component or DSP) so nothing strange in here
      I always stop the timer before computing anything and reactivate it at the end, I don't know if it is necessary/good practice though.

      Can't help pressing F5 in the forum...

      1 Reply Last reply Reply Quote 0
      • d.healeyD
        d.healey
        last edited by d.healey

        You're starting the timer inside the timer callback so it will create an endless loop. Put Console.print("HELLO WORLD") after the .stopTimer(); call and you'll see it outputs forever until it crashes.

        Libre Wave - Freedom respecting instruments and effects
        My Patreon - HISE tutorials
        YouTube Channel - Public HISE tutorials

        ustkU 1 Reply Last reply Reply Quote 0
        • ustkU
          ustk @d.healey
          last edited by ustk

          @d-healey That the point in fact. I need it to loop forever. Is there another way?

          Can't help pressing F5 in the forum...

          d.healeyD 1 Reply Last reply Reply Quote 0
          • d.healeyD
            d.healey @ustk
            last edited by

            @ustk If you need it to loop forever why do you stop the timer?

            Libre Wave - Freedom respecting instruments and effects
            My Patreon - HISE tutorials
            YouTube Channel - Public HISE tutorials

            ustkU 1 Reply Last reply Reply Quote 0
            • ustkU
              ustk @d.healey
              last edited by

              @d-healey Simply because there's something basic I don't understand with timers.
              If, for any reason, the code inside is not done within the 30ms, what happens?
              This is why I always do that (I'm paranoid) but it might be bad...

              Can't help pressing F5 in the forum...

              1 Reply Last reply Reply Quote 0
              • d.healeyD
                d.healey
                last edited by

                Just start the timer in on init as you have done and remove the stop/start code from inside the timer. This will make it run forever as soon as the plugin is initialized. I suspect that the execution time-out you're getting is caused by something in your //some code section, since I don't get that error message when I copy and paste your code.

                Libre Wave - Freedom respecting instruments and effects
                My Patreon - HISE tutorials
                YouTube Channel - Public HISE tutorials

                ustkU LindonL 2 Replies Last reply Reply Quote 0
                • ustkU
                  ustk @d.healey
                  last edited by

                  @d-healey Thanks, I removed them and don't get the error apparently.
                  That what I thought at first but the code inside is not twisted so there's no reason

                  Although I noticed something with Hise:

                  Every time I have a project getting big, Hise behave strangely. I say strangely because it's not 100% the same issue all the time.
                  Often, at init, I get many warnings at the same time, like component not found and things like that.
                  I just press F5 and everything's back to normal.
                  I work, recompile, then sometimes errors again, sometimes it's ok, and sometimes Hise crashes.

                  It's like big projects cause instability. I don't think (I can't be sure of course) that it's because of my code/design. But who knows...
                  My exports work fine and pass the plugin validation

                  Can't help pressing F5 in the forum...

                  d.healeyD 1 Reply Last reply Reply Quote 0
                  • d.healeyD
                    d.healey @ustk
                    last edited by

                    @ustk What do you mean by a big project?

                    Libre Wave - Freedom respecting instruments and effects
                    My Patreon - HISE tutorials
                    YouTube Channel - Public HISE tutorials

                    ustkU 1 Reply Last reply Reply Quote 0
                    • ustkU
                      ustk @d.healey
                      last edited by

                      @d-healey Complex interface and big DSP

                      Can't help pressing F5 in the forum...

                      1 Reply Last reply Reply Quote 0
                      • LindonL
                        Lindon @d.healey
                        last edited by

                        @d-healey -- hmm OK but I also have a need to run a timer - and to stop it inside the timer and then calc a new "time" and restart the timer.. so simplified example:

                        const var myTimer = Engine.createTimerObject();
                        var kounter = 0;
                        
                        myTimer.setTimerCallback(function()
                        {
                            myTimer.stopTimer();    
                        
                            if (kounter == 0)
                            {
                               myTimer.startTimer(30);
                               Console.print("short");
                            }else{
                                myTimer.startTimer(200);
                                Console.print("Long");    
                            }
                            kounter = 1 - kounter;
                        
                        });
                        myTimer.startTimer(30);
                        

                        How would you do this?

                        HISE Development for hire.
                        www.channelrobot.com

                        d.healeyD 1 Reply Last reply Reply Quote 0
                        • ustkU
                          ustk
                          last edited by

                          I still have the timer issue...
                          I have a lead though!
                          The panel can be hidden, and I know hidden panels are not repainted in the background and cause issues...
                          Investigating...

                          Can't help pressing F5 in the forum...

                          1 Reply Last reply Reply Quote 0
                          • d.healeyD
                            d.healey @Lindon
                            last edited by

                            @ustk said in TimerObject execution time-out error:

                            @d-healey Complex interface and big DSP

                            I haven't done any DSP stuff so this could be causing instability that I haven't experienced.

                            @Lindon

                            In you're example the timer effectively won't stop. So you might as well get rid of the .stopTimer() call. The call to startTimer() (inside the callback) will just change the timer's speed so should work how you want.

                            Libre Wave - Freedom respecting instruments and effects
                            My Patreon - HISE tutorials
                            YouTube Channel - Public HISE tutorials

                            LindonL 1 Reply Last reply Reply Quote 0
                            • LindonL
                              Lindon @d.healey
                              last edited by

                              @d-healey said in TimerObject execution time-out error:

                              @ustk said in TimerObject execution time-out error:

                              @d-healey Complex interface and big DSP

                              I haven't done any DSP stuff so this could be causing instability that I haven't experienced.

                              @Lindon

                              In you're example the timer effectively won't stop. So you might as well get rid of the .stopTimer() call. The call to startTimer() (inside the callback) will just change the timer's speed so should work how you want.

                              --ohhhh. riiiight I didnt know I could effectively change the timer length without stopping it - great. Thanks.

                              HISE Development for hire.
                              www.channelrobot.com

                              1 Reply Last reply Reply Quote 0
                              • Christoph HartC
                                Christoph Hart
                                last edited by

                                Every time I have a project getting big, Hise behave strangely. I say strangely because it's not 100% the same issue all the time.

                                One thing that might cause issues is the compile time-out which fires if you have a lot of stuff to do in the first onInit call. For example loading a lot of audio files might cause the time-out to fire, but if you compile it multiple times, it wents through.

                                The default is 5 seconds, but you can raise that value if you run against that limit with bigger stuff in the HISE settings (search "Compile Timeout").

                                ustkU 2 Replies Last reply Reply Quote 0
                                • ustkU
                                  ustk @Christoph Hart
                                  last edited by ustk

                                  @Christoph-Hart Yep that's what I thought at first, so I set it to 10sec, but my compile time is about 2sec with the i7...
                                  It's like the scripts compile before the interface is done, because all the errors (in that case) are only "component not found" (sometimes 10-15 components)
                                  I got all scripts in external .js files (about 35 files). Maybe it can be related...

                                  Another thing, when I recompile (just F5) in the onInit script it generally works well. But if I'm in a subscript it's a crash 80% of the time (shift-F5 seems more stable though, because I guess it's more like an init sequence). So now I always keep a tab with the onInit opened and I try to compile in that tab even if I work somewhere else. Recompiling in the interface designer works too.

                                  Can't help pressing F5 in the forum...

                                  1 Reply Last reply Reply Quote 0
                                  • ustkU
                                    ustk @Christoph Hart
                                    last edited by

                                    @Christoph-Hart It's weird, every now and then I get an execution time out from anywhere in the project. A loop in this script, a timer in that one, another loop somewhere else...

                                    Nothing is related, and it happens with no apparent reason, except that it's when I pass the mouse on a painted panel (a hover redraw the panel and the execution time out points to a loop in the paint routine)... I recompile, it's gone, and 5 minutes later I get another one somewhere else...

                                    Nothing should be twisted in the code, and everything works fine (parts of these scripts are several months old and I haven't modified them)

                                    If you want to test my project I can share the git with you (only if you're interested, I know you have bigger fish to fry ;) )

                                    Can't help pressing F5 in the forum...

                                    ustkU 1 Reply Last reply Reply Quote 0
                                    • ustkU
                                      ustk @ustk
                                      last edited by ustk

                                      I was thinking... In a panel constructor (same panel 4 times), I have a paint routine. In this paint routine, I have a loop (i goes up to 50) to paint a curve out of two values.

                                      The question is, what happens if another panel callback is called when the loop of the first one isn't yet done?
                                      I'm thinking of a leaking i

                                      Can't help pressing F5 in the forum...

                                      LindonL 1 Reply Last reply Reply Quote 0
                                      • LindonL
                                        Lindon @ustk
                                        last edited by

                                        @ustk try defining i in each funciton

                                        local i;

                                        HISE Development for hire.
                                        www.channelrobot.com

                                        1 Reply Last reply Reply Quote 1
                                        • First post
                                          Last post

                                        45

                                        Online

                                        1.7k

                                        Users

                                        11.7k

                                        Topics

                                        101.9k

                                        Posts