Invalid value

Yesterday I went running with my data field and it "Iq!" crashed due to an invalid value. (It's the first time I got this crash, on other occassions I ran 30k with the field without issues...)

This is the contents of the CIQ_LOG.TXT file:
ERROR: Invalid Value
DETAILS: Failed invoking <symbol>
STORE_ID: 23ea030130c64c33b4ef63e2b5394e76
CALLSTACK:
@PC = 0x00000000
@PC = 0x00000000
@PC = 0x00000000
@PC = 0x00000000
@PC = 0x00000000

Not really helpfull this error, as I don't even know from which function the error was thrown from, so it's kinda seeking for a needle in a haystack...

I'm checking all over the place for null values, so I don't think an invalid value could've been a null value...

I'm assuming the invalid value could come from assigning eg a float value to an int value, although I would expect an implicit conversion there, but I also double checked my code for that...
I also checked for assignments of float values to int variables, although I would've expected truncation there and not an invalid value error...

I also analysed the data and what seems odd: at the moment of the iq! crash the cadence was 0... (I didn't stop running, so it shouldn't have dropped to 0, but anyway...)

I'm not doing anything with the cadence data in my code (I don't retrieve it's value), but I assume the lower level function that calls the compute(info) function would read all this information before passing it to the compute function.

Could it be that this lower level function throws this "Invalid Value" error? And if so what to do about this? try catch inside the compute will probably be too late...

I played back the activity file in the simulator, but getting no issues there...

link to my activity file: https://connect.garmin.com/modern/activity/1551422461 (crash at about 21:32 (where the ahead time recording stops))

the drop in cadence is the more apparent after importing in sporttracks:
  • One other thing I'd look for is a typo in a variable name and in a code path that isn't the "norm". Something happens on the watch you don't see in the sim, that path is taken, causing the crash.
  • thanks for the suggestion Jim, have had a look at my var names, no mis-casings seen. At about the 4k point where it crashed it should've passed pretty much all the code paths... I first thought it might've been in my on lap code so added debug-statements there, but if I look closely at the graph I think it crashed slightly beyond that point.

    Ran a new training session today, no crash of the field... which is both good and bad I guess, good if the crash would never re-appear :)

    Anyway I've gone through my code again, and what I don't check in my compute function is whether the info object itself is null. Should I?
    Another thing I don't check is whether the info contains a field currentHeartRate. Should I?

    code like it is now:
    function compute(info) {
    hr = (info.currentHeartRate != null ? info.currentHeartRate : 0);
    ...


    I could change it to:
    function compute(info) {
    if (info != null) {
    if(info has :currentHeartRate) {
    hr = (info.currentHeartRate != null ? info.currentHeartRate : 0);
    }
    ...
    }


    makes coding like this a bit of a *** though...
    and it would also be strange to have an info object that suddenly is null or an info object that suddenly doesn't have a currentHeartRate...

    I'm hoping that Brandon, Brian or Coleman can shed some light on when the "Invalid value" error can occur... as I'm pretty much taking guesses in the wild here :)
  • I know for me, in both a DF or full app, I check EVERY value I get from Activity.Info for a null. A null seems to happen at/before recording starts, and I don't recall something turning null well into the recording though.
  • Former Member
    Former Member over 8 years ago
    I think all the backtrace addresses being 0x00000000 indicates that this error traces into the API code, and not your app code. It is possible this is an VM bug, but unless you find a condition that can trigger it reliably, we will unfortunately have a hard time investigating.

    The info parameter shouldn't ever be null. I don't think you should need to check it at that level.
  • during my evening training I again had no issues... so like you suggested it might be indeed some bug in the vm itself then that happens under certain circumstances...

    It won't be easy to track this bug down... maybe your engineering team has tools to play back the fit file on a real 735xt device? Perhaps they can spot the issue then? (i linked to my activity file in the first post)
  • A user also reported this error, he says it crashed at about the 12 mile marker. I don't see anything odd in his activity file ( https://connect.garmin.com/modern/activity/1558091490 ), so I think the zero cadence I spotted during my experience with the error was just a coincidence.

    Since the error I had modified my compute function to (the user was already using a version with this "fix"):
    function compute(info) {
    if (info != null) {
    if (info has :currentHeartRate) {
    hr = info.currentHeartRate != null ? info.currentHeartRate : 0;
    }
    if (info has :currentSpeed) {
    speed = info.currentSpeed != null? info.currentSpeed * 3600 / unitP : 0.0;
    }
    ...
    }
    }

    ... so I think we can pretty much exclude that the error is coming from within the compute as I'm double checking everything for nulls and whether or not the info object contains said field...

    The user did report that he was using the data field in combination with Runner Window on a second datascreen, at the time I had the crash I was using it in combination with the MyCoach data field.

    After I removed this other data field I've done training runs with my "Peter's (Race) Pacer" field up until 6 hours and have not seen the crash re-appear on my watch. So perhaps the "Invalid value" error could occur when 2 connect iq data fields that both require some processing power are used in combination?

    But I understand that this is a difficult situation to reproduce by the development team...

    A request: would you kindly ask the development team to add extra context information to the invalid value error (at least have the "value of the invalid value", preferably also "to what is this value being assigned" and in "which context/function is this invalid value occuring"). This way we might be able to spot when this error is happening. Thanks. :)
  • What is unitP, a non-zero constant I assume?
  • it's a variable to get the pace in metric or statute, initialized in metric in my var section (1000.0), when the devicesettings say it should be statute I change it in the initialization function to 1609.344...

    but (as Brian already suggested) I also don't think the error is coming from within the compute function or from within my app at all, but rather from a call within the api, I'm hoping that it's possible that the dev team can add more info to the "invalid value" error so that we can have the api fixed...