Nativescript: Performance issues on Android App with NS 3.4.0

Created on 4 Jan 2018  路  18Comments  路  Source: NativeScript/NativeScript

Please, provide the details below:

Hey guys, I'm having serious problems with my app which used to run smoothly but now keeps freezing and I'm always getting this error:
ActivityManager: 109% 21582/ org.nativescript.OnTheGo: 104% user + 4.9% kernel/ faults: 308144 minor 75 major
ActivityManager: Killing 21582:org.nativescript.OnTheGo/u0a451 (adj 200): remove task

It crashes sometimes, others it simply shows "App is not responding / WAIT CLOSE" and then I have to wait.

Does anyone have a clue on what should I do to fix this?

Did you verify this is a real problem by searching [Stack Overflow]

Yes, I've searched and couldn't find anything.

Tell us about the problem

Basically I guess my app is consuming a lot of resources even though the issue wasn't happening like 2 weeks ago and I haven't change the code that much since then.

Which platform(s) does your issue occur on?

Android

Please provide the following version numbers that your issue occurs with:

  • CLI: 3.4.0
  • Cross-platform modules: 3.4.0
  • Runtime(s): 3.4.0
android

Most helpful comment

Just a quick update! After some debugging I actually found out what the issue was, and it is not related to the issue @pedromareis has.

I was using a CSS animation with "animation-iteration-count: infinite" and after navigating to another page, it seems that the animation somehow continues in the background and slowly, but surely, using resources and at some point killing the app. This only seems to happen on Android.

The simple solution was of course to stop/remove the animation before navigating to another page.

All 18 comments

... haven't change the code that much since then ...

@pedromareis without providing any code base or sample project to debug it would be hard to guess what might be causing your issue.

@NickIliev
Hey, well the project is from the company I work for so I can't share any code, also it's way too big for me to make a sample project where you could see the issue... Basically I don't know how I can help you understand what's going on with the performance of it although, after downgrading the project to NS 3.2.0 + tns-core-modules 3.2.0 (with the exact same code) I can notice a lot of improvements and the app doesn't crash anymore...
Any idea of what it could be?

@NickIliev I started experiencing the same issues since upgrading but surprisingly, only on newer Android phones. On lower versions, it seems to work as usual but the reverse is the case on newer phones.

I could send you an archive via mail if you could point me in the right direction since i've tried what i could.

@tsonevn @NickIliev @vakrilov is there any way we can fix or debug this? I experienced this same effect with [email protected] and i've been using @3.2 as it is until i choose to make the move to @3.4.

Its so bad on android that it still freezes even on a phone with 6GB of RAM after staying on for about a minute. At times, when left idle, the app just closes it self.

I made this known to @vakrilov after @3.3 but didn't get to create an issue since i just reverted backwards.

@PanayotCankov @tsonevn @NickIliev can we get help here?

@jogboms contact me in the community slack channel (username: niliev) or send a link to the archive here if you have a public demo application so we can investigate the issue locally.

@jogboms the issue seems to be related to the garbage collector being called on navigation from the SideDrawer wrapper used in your application. We are currently working on introducing a new way to structure your NativeScript application including an out-of-the-box way to provide RadSideDrawer as root component for the whole application. I will get in touch with you once we have a recommended way to structure the application with a root side drawer.

Oh! thanks @NickIliev. So what can i do right now about this?

I have more-or-less the same problem. No issue on iOS, but on Android the app freezes after a minute or so and then dies with the message:

ActivityManager: 99% 9812/org.nativescript.enterprise.MyApp: 97% user + 2.7% kernel / faults: 116663 minor 752 major
ActivityManager: 99% 9812/org.nativescript.enterprise.MyApp: 91% user + 7.7% kernel / faults: 27773 minor
ActivityManager: 101% 9812/MyApp: 93% user + 7.7% kernel
ActivityManager: Process org.nativescript.enterprise.MyApp (pid 9812) has died(2043,250)

I have tested this on both a Samsung Galaxy S7 Edge and a LG K8. I dont use a SideDrawer. I use normal navigation as described in the NativeScript Angular tutorial. Also I am running version 3.4.1.

Just a quick update! After some debugging I actually found out what the issue was, and it is not related to the issue @pedromareis has.

I was using a CSS animation with "animation-iteration-count: infinite" and after navigating to another page, it seems that the animation somehow continues in the background and slowly, but surely, using resources and at some point killing the app. This only seems to happen on Android.

The simple solution was of course to stop/remove the animation before navigating to another page.

@svanegaard @NickIliev I can confirm that the CSS animation with animation-iteration-count: infinite is bugged. After upgrading to 1.4 yesterday I have been tracking down the exact same problem of the app freezing/dying after a minute or so. Removing the infinite setting resolved it.

Thanks, @svanegaard. I fixed all instances of animation-iteration-count: infinite and Number.POSITIVE_INFINITY from my animations by either removing them and/or killing all animations programmatically. This saved a ton of fruitless debugging hours for something that used to work.
@NickIliev If the RadSideDrawer really creates some memory leaks, I'd really be hoping for a hotfix as well.

馃槃 鉁岋笍

@svanegaard the issue is only observed in the custom code base by @jogboms and is not reproducible with the standard usage of RadSideDrawer - we are currently investigating the custom case but you should not worry about it as it is related to a RadSideDrawerbeing used as a wrapper.

@jogboms we are still investigating the options and testing how to expose RadSideDrawer as a root project component in NativeScript 4.x.x and will post any related info in the documentation articles.

Thanks, @NickIliev. I'd remain expectant. 馃檶

@ShawnPavel @svanegaard can you provide a sample app or Playground demo which can reproduce the issue with animation-iteration-count: infinite freezing the app - I am trying to reproduce the problem to no avail.

closing due to inactivity

This error is still on in 5th version of NativeScript.
As mentioned before it only affects android, works perfectly fine with ios.

Therfore infinite animation shouldn't be used, android apps using it freezes and crashes with ANR.

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

lscown picture lscown  路  163Comments

tjvantoll picture tjvantoll  路  46Comments

VladimirAmiorkov picture VladimirAmiorkov  路  46Comments

valentinstoychev picture valentinstoychev  路  70Comments

danielzzz picture danielzzz  路  59Comments