Flic Home

    Community

    • Login
    • Search
    • Popular
    • Users

    "cannot push beyond allocated stack" fatal error.

    Flic Hub SDK
    2
    2
    481
    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.
    • martinm
      martinm last edited by

      Turns out it is quite easy to cause what looks like an Flic Hub (Firmware: 3.0.12) internal stack error. This (non recursive) code runs perfectly on a regular web browser but will crash after 55 iterations on the hub.

      var counter =0;
      
      function stacksize()
       { err = new Error();
         return err.stack.split("\n").length-1;
       }
      
      function run()
        {console.log("iteration "+counter+" / stack size ="+ stacksize() );
         counter++;
         setTimeout(run,1);
        }
      
      run();
      

      Here are the results on the SDK console:

      iteration 54 / stack size =2
      iteration 55 / stack size =2
      FATAL ERROR:
      uncaught: 'cannot push beyond allocated stack'
      

      A workaround is to use setInterval()

      function run()
        {	console.log("iteration "+counter+" / stack size ="+ stacksize() );
      	  counter++;
       }
      setInterval(run,1)
      

      But it's not a perfect solution, with some slightly more complex (but still non recursive) code, the 'cannot push beyond allocated stack' error will randomly appear again.

      The "Restart after crash" option doesn't seem to have any effect, at least on this error.

      Long story short, I'm under the impression that the hub SDK is a nice little toy, but it is unfortunately too limited/unreliable for even basic "real life" applications. 😞

      oskar 1 Reply Last reply Reply Quote 0
      • oskar
        oskar FlicTeam @martinm last edited by

        @martinm Hi!

        Excellent bug report, thank you!

        This has been fixed in the new firmware that is currently in beta. If you want to try it out, please PM me your hub serial number and I can assign the new firmware to your hub.

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