Zigbee App keeps pausing

I am working on an app to link Zigbee devices and have already published it to the app store, but now I noticed that the app pauses on its own after a couple of minutes (it shows the pause symbol in my app overview).
It doesn’t necessarily seem to crash but my devices become unavailable since the app is no longer running at that point.
Did any of you experience something similar and does someone have a suggestion on how to debug this?
When I submit a crash report the stdout and stderr are completely empty.

Sounds like your app is getting paused because it’s using too much memory (not sure what the max is, I think 80MB?). Should be visible in Insights.

If I look here: Homey Developer Tools
And then for my own app, it says it’s using a consistent 28.1MB.
Is there any other spot where I can check the memory usage?

Yes, not sure if the value will differ though

Hit the graph icon on the left
Enter ‘app’ in searchfield
Scroll to app name

Not sure in what field, but it won’t show up in either:

Okay, I just found out it is a memory issue, right before it crashes it makes one huge spike, but I don’t know why. Someone any idea how I can try and debug this?

I think it’s still possible to use the V8 inspector: Debug app code - #2 by robertklep

1 Like

Odd, I get a listing of installed apps. But you found the memory issue anyways I see :wink:

You have the Power User setting turned on :wink:

I did also find that one now I turned the power user setting on, but that one has a wider x-axis so for my purpose at the moment a little less useful since it happens within a matter of minutes.
However, I did change the intervalPoll setting on a couple of the registerCapabilities and it seems to have lowered the ramping of the RAM. It still spikes after a while, but from 16MB to 20MB now which is acceptable and doesn’t break the app.
Still wondering where the sudden spike comes from though, if it would slowly creep up I can imagine some logging slowly building up, but this is not a behavior I can really understand.
Currently I have declared my capabilities as follow:

this.registerCapability("measure_power", CLUSTER.ELECTRICAL_MEASUREMENT, {
      get: 'activePower',
      getOpts: {
        getOnStart: true,
        getOnOnline: true,
        pollInterval: 1000,
      },
      report: 'activePower',
      reportOpts: {
        configureAttributeReporting: {
          minInterval: 0,
          maxInterval: 10,
          minChange: 1,
        }
      },
    });

Pretty standard I believe.
I have also attached my current memory usage, the strange thing is that it is completely stable after starting up the app for about 20 minutes or so, and then it suddenly spikes and afterwards it goes up and down tiny amounts:


One last remark, not sure if it has anything to do with this, but lately my Homey tends to “fall away” every now and then. Via my app and via the online portals, my Homey is completely unreachable for a couple of seconds. Not sure if this is behavior that happened before, since I didn’t check the app as often as I do now :sweat_smile:

Is your Homey still using its original Athom power supply? If so, that could be the reason. Replacing it with a decent USB power supply has solved a lot of random issues for a lot of people.

Ah, good one, I thought I might be related to the memory issue, but I’ll try a new power supply, any suggestions?

If you happen to have an old iPad charger, those are pretty good. Otherwise, any decent USB power supply capable of supplying about 2.3/2.5A or more is okay. Just don’t buy a cheap one from Aliexpress or the local telefoonhoesjesstore.

1 Like

:sweat_smile: