Random Array Out Of Bounds Error in sensor data callback

Former Member
Former Member
Hello,

i have an issue i am unable to debug...

I have implemented a b2b recorder that is part of an CIQ3 App i am working on.
In general my App works as i want it to but sometimes the App crashes randomly and i have no idea why.

Log and code follows...
  • Former Member
    Former Member over 6 years ago
    Thanks Travis!!! This is a great relief. This was bothering me for a few weeks. Want to release our App, this is the only system crashing bug. Looking forward for the fix and our release. Many thanks for your reply.
  • Hi  - I just ran into the exact same problem with the FR165 on the sim. SDK 8.2.2 - all devices up2date. I noticed that the crash happens just after receiving no heartbeatintervals from the sensor within a sec. Once it crashes, it crashes immediatly (first sensor callback) when starting the app again - this happens until I close the sim and start it again. Then it works until the next empty callback. Same code, same scenario does not crash on the fenix 6 pro in the sim (or other devices)

  • This Array Out Of Bounds Error almost every time means there's a bug in your code. If you're lucky enough to be able to reproduce it, then the 1st thing I'd do is to look for all array access in my code and add a log 1 line each one of them, and log the array size and the index. I'm pretty sure that you'll see something like you're doing something like arr[0] on an empty array.

  • so this is my callback function (for testing) that produces an Error: Array out of bounds. 

    function callback(data) {}

    Sensor.registerSensorDataListener(method(:callback), {
                        :period => 1,
                        :heartBeatIntervals => {
                            :enabled => true,
                        },
                    });
    Exact error msg:

    Error: Array Out Of Bounds

    Error Details: Error in sensor data callback

    Stack:

    (No stack trace available)

    Again, so far I've only seen this in the sim with the fr165

  • And it doesn't always happen? Then maybe it depends on the data? Can you log the data in the 1st line, or it fails before that? Does data come from your server?

  • No only happens after some time. And when i log it, it happens after a callback when there is no heartbeatintervals returned from the simulated sensor - when the callback fails, it fails before the log - so really before anything is execute in the callback. Data does come from the simulator. 
    again - this does not happen with other devices in the simulator! Never! So I‘m 100% sure this has nothing to do with my code (actually there is exactly zero my-code in the callback - there is no code at all as seen above)