Complete
over 2 years ago

bug: System Error in calling GenericChannel.getDeviceConfig()

Error Name: System Error
Occurrences: 1
First Occurrence: 2022-11-18
Last Occurrence: 2022-11-18
Devices:
Edge® 530: 9.50
App Versions: 2.1.0
Languages: ita
Backtrace:
ExtHRMSensor.paired:146 var deviceCfg = GenericChannel.getDeviceConfig();
ExtHRMSensor.onMessage:92


  • Since I'm still seeing these errors in ERA I'd like to help to hunt it down. But I am not able to reproduce it (I don't even own any of the devices that had the error). However I'd like to make a case that this has to be a VM bug:

    1. the documentation doesn't mention any possible exception being thrown by getDeviceConfig()

    2. it's a System Error

    3. I tried to reproduce it (in simulator: ): I assumed that maybe this happens when getDeviceConfig is called before setDeviceConfig in some race condition, but when do that on purpose, then nothing happens:

    class TestApp extends Application.AppBase {
    
        public function onMessage(msg as Message) as Void {}
    
        function initialize() {
            AppBase.initialize();
            var c = new Ant.GenericChannel(method(:onMessage), new Ant.ChannelAssignment(
                        Ant.CHANNEL_TYPE_RX_NOT_TX, // Bidirectional Receive (Slave)
                        Ant.NETWORK_PLUS)
                    );
            System.println("c: " + c);
            var deviceCfg = c.getDeviceConfig();
            System.println("d: " + deviceCfg);
        }
    }

    I see:

    Obj: 132
    Obj: 200
    Most of the errors are from different edge devices, but also some from epix2, fenix7:
    epix Pro (gen 2), edge 1030, 1030 plus, 1050, 830, 530, explore, fenix 7x, fenix 7x pro
  • still happens on fenix7, edge830

  • So I am looking at my code and trying to think what scenario could reproduce it. Is it possible that onMessage is called with MSG_ID_BROADCAST_DATA, then "immediately" after that (from inside onMessage) I call GenericChannel.getDeviceConfig() but in some very rare cases between the time onMessage was called and the time I call getDeviceConfig some state of the channel changed (I don't know, let's say it disconnected) and that's wy getDeviceConfig generates the error?

    the documentation of GenericChannel.getDeviceConfig() doesn't seem to mention any possible issues, so if I am in my class that extends GenericChannel, and I am inside onMessage, should there even be anything I need to check before I call getDeviceConfig()? And even if yes, then would something like:

    if (checkWHatBrandonSays()) {
      GenericChannel.getDeviceConfig();
    }
    

    work? Or can still the state be changed between my call to checkWhatBrandonSays to the call of getDeviceConfig?

  • Was it a one-time reproducing or are you able to reproduce it in a few trials whenever you want?

    In my code I only call getDeviceConfig() in one place and it's only called right after a pairing happened (when onMessage got MSG_ID_BROADCAST_DATA or MSG_ID_ACKNOWLEDGED_DATA) so if your hint about the distance is indeed helpful then I might be able to see this if I start out of range and then slowly get closer until it connects. But I don't think it's that easy, because in the past I did tests of disconnects and reconnects (with the same HRM or with different HRM) and I don't remember seeing this (or any other) error