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
    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)

  • Hello, I have the exact same issue. I could not believe that a 7 year old bug could still reside in the Garmin SDK, but this is how Garmin engineering works unfortunatelly. We see the very same story with mssaging queue broken issue which is also ancient and not fixed till today, we instead using the messaging API we need to workaround using a webserver for watch to phone communication!

    Anyways I can confirm the Sensor issue on FR55. My intent was to update my ancient Garmin app to work well with latest devices. So I purchased the Forerunner 55.. what a surprice that my code started to crash with:

    Error: Array Out Of Bounds Error
    Details: Error in sensor data callback
    Time: 2026-04-23T10:26:16Z
    Part-Number: 006-B3869-00
    Firmware-Version: '11.03'
    Language-Code: eng
    ConnectIQ-Version: 6.0.0
    Filename: G4N63738
    Appname: Sleep
    Stack:

    Even this did not happen on my old Vivoative 4S testing device.

    I have made sure to get rid any potential IAOOB in my code and debugged this issue for 2 days only to find out that this error without any stack trace BTW.. will happen when with an empty listener. 

    The problem is triggered by:

    :heartBeatIntervals => {
    :enabled => true
    }};

    Then the code randomly crashes even before calling my listener - in the Sensor code..

    During this debugging I have found out about the dynamic array imits on Monkey C which may cause IAOOB issues and I made sure all my arrays are properly handled, I'm working with a limit of 128..

    I can only assume that this issue is cause by a similar problem directly in the Sensor implementation. Maybe on memory restricted devices such as FR55 the max dynamic array size breaks the Garmin code?

    Now what can I do? Shall I complete remove the HR, HRV functionality from my Garmin integration? Or small I try to build an affected device list over time and gradually this to blacklist devices? 

    Could please anyone from Garmin look into this so that Garmin does not seem only like a toy platform were serious bugs are ignored for millenia? Does garmin even takes it's SDK seriously?

    Many thanks.

    Best and fingures crossed to all dev who still try to make thinks working on Garmin!

    P.S. And then you talk to Garmin managers and ask them to get access to teh BT APIs to gather sensor data and bypass the buggy SDK and they tell you.. well only if you buy 3000 devices from us :))) what a joke!