Flic Home

    Community

    • Login
    • Search
    • Popular
    • Users

    Flic Hub firmware bug causes crash after sending 36 UDP packets.

    Developers
    3
    6
    1020
    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.
    • peter.kueffner
      peter.kueffner last edited by

      I was developing a module on the Flic Hub using the Flic Hub SDK. The module sends out all button presses as UDP messages.

      While working on the module, I noticed a strange bug, which I assume is a firmware issue - when sending the 36th UDP message, the module crashes with a

      FATAL ERROR:
      uncaught: 'cannot push beyond allocated stack'
      

      I made a minimal module that will reproduce the bug consistently:

      var dgram = require("dgram");
      
      function SendJSON(data)
      {
          try {
              udp = dgram.createSocket("udp4");
              udp.send(data, 32768, "127.0.0.1", function(err) {
                      console.log("UDP sent. Return: " + err);
                      udp.close();
                  });
          } catch(e) {
              console.log("Error sending button state!");
          }
      };
      
      var i = 0;
      var myInt = setInterval(function() {
              i ++;
              console.log("Sending packet " + i);
              SendJSON("" + i + "  ");
          }, 100);
      

      Flic Hub SDK Console output:

      Sending packet 1
      UDP sent. Return: null
      Sending packet 2
      UDP sent. Return: null
      Sending packet 3
      UDP sent. Return: null
      [...]
      Sending packet 34
      UDP sent. Return: null
      Sending packet 35
      UDP sent. Return: null
      Sending packet 36
      FATAL ERROR:
      uncaught: 'cannot push beyond allocated stack'
      

      I consider this a firmware bug because of the following reasons:

      • the "fatal error" is not catched by the try-catch block
      • the module is still considered "running" even after the crash (the SDK's "play" button stays in "can be stopped" state)

      Is there any solution to this?

      Emil 1 Reply Last reply Reply Quote 0
      • johan 0
        johan 0 last edited by

        @Emil I'm having the same problem, with the original Hub on version 3.0.12. How do I get the fix? Workaround at the moment is to make the module crash every 10 seconds and enable restart on crash. If I would get over the limit before crashing myself, the bug is triggered and it will fail without restarting.

        1 Reply Last reply Reply Quote 0
        • peter.kueffner
          peter.kueffner @Emil last edited by

          Thanks a lot! I will make sure to try the fix when the firmware update comes out.

          Are there any plans to when this will happen?
          And is there any way to get a notification for new firmware updates?

          1 Reply Last reply Reply Quote 0
          • Emil
            Emil FlicTeam @peter.kueffner last edited by

            @peter-kueffner The issue has been fixed and the fix will be included in the next firmware update.

            peter.kueffner 1 Reply Last reply Reply Quote 0
            • peter.kueffner
              peter.kueffner @Emil last edited by

              Hi @Emil, is there any progress on the issue?

              Emil 1 Reply Last reply Reply Quote 0
              • Emil
                Emil FlicTeam @peter.kueffner last edited by

                Thanks for the report. We will take a look. It seems like a bug in the hub sdk.

                peter.kueffner 1 Reply Last reply Reply Quote 0
                • First post
                  Last post