Repository navigation
Description
Did you verify this is a real problem by searching [Stack Overflow]
It is a real problem because i have tested it and few of the users already use the app.
I also have been searching for similar issues for a few days now.
Tell us about the problem
The problem is. The app is smooth for a certain period of time , let's say 5 10 minutes, and then
all of a sudden at a random points in time (maybe after selecting an article and a popup dialog opens)
it freezes for a second and then it continues. Few times i had problems when navigating (after navigation) it freezes for a few seconds and it continues (sometimes i get the native not responding dialog). I have seen this issues on 3 or more devices(not that they were top notch units of hardware).
Which platform(s) does your issue occur on?
Android
Please provide the following version numbers that your issue occurs with:
- CLI: 2.5.4
- Cross-platform modules: 3.0.0
- Runtime(s): 3.0.0 (tns-android)
- Plugin(s): (all the deps):
"dependencies": {
"angular/animations": "~4.1.0",
"angular/common": "~4.1.0",
"angular/compiler": "~4.1.0",
"angular/core": "~4.1.0",
"angular/forms": "~4.1.0",
"angular/http": "~4.1.0",
"angular/platform-browser": "~4.1.0",
"angular/router": "~4.1.0",
"nativescript-angular": "~3.0.0",
"nativescript-cardview": "^2.0.0-rc.0",
"nativescript-checkbox": "^1.2.8",
"nativescript-floatingactionbutton": "^3.0.0",
"nativescript-ngx-fonticon": "^2.2.0",
"nativescript-ripple": "^1.1.0",
"nativescript-snackbar": "^1.1.6",
"nativescript-telerik-ui": "^2.0.1",
"nativescript-theme-core": "~1.0.2",
"reflect-metadata": "~0.1.8",
"rxjs": "~5.3.0",
"tns-core-modules": "~3.0.0"
}
Please tell us how to recreate the issue in as much detail as possible.
For now i would be glad if you can just pin point what might be the problem (where should i seek the answer).
I know about the gc() and --expose_gc flag in package.json. And i did upgrade from 2.5.x to 3.0.0 because i thought that would be a good idea.
p.s. i would love to know how can i profile the app (check device resources ram cpu load ...etc.)
p.s.2 i am new to the android world so bare with me :)
Is there code involved? If so, please share the minimal amount of code needed to recreate the problem.
Not at the moment , but if i struggle some more with this i can provide u with debug version so u can run it ...
Activity
NickIliev commentedon May 16, 2017
@Dimitrievskislavcho indeed providing us with a sample application to work with would be great!
There might be multiple reasons for this to happen (heavy-load API calls, GC calls on navigations, etc.) so working with a sample application to investigate this further is a must.
When providing the sample code you can also specify on what devices/emulators you are using for testing.
NickIliev commentedon May 16, 2017
@Dimitrievskislavcho FYI we have currently dedicated some resources to this task which is related to tracking performance improvements so you can track this thread for tracking techniques.
Cayan commentedon May 17, 2017
I'm having these issue as well, I've profiled the app using Debug Inspector and it seems like nothing is going on. I've noticed these in two different scenarios:
Dimitrievskislavcho commentedon May 17, 2017
@NickIliev Thanks for giving me directions mate. I had something else the past two days and that is why i didn't have time for some profiling and perf testing. I'll check the link you've provided for me.
Dimitrievskislavcho commentedon May 22, 2017
Hello there again. @NickIliev i tried to do some profiling today but i guess i failed at doing so. Since i am really new to the android dev or android at all i don't really know how and with what tools i should do the profiling. I tried using android monitor but i am guessing there is no GUI for real time profiling (or it's just me and i have no idea what am i doing). The thing is i want to lose my time pinpointing the problems i have not yours :). I want to know how to do profiling and see cpu, gpu and mem usage while i run my app and while i go through my working flow with the app. The problem persists when i click on the groups and some rendering is needed like in ng-repeat with nested angular components and so. And of course the good ol' navigation go to page and destroy this one scenario.
p.s. sorry about the long text.
p.s.2 if you can reopen this issue i would gladly post here so other people can relate to my problem.
p.s.3 i had the crash not responding message after few minutes of work again.
Dimitrievskislavcho commentedon May 25, 2017
@NickIliev @Cayan Hello guys. The noob that i am, i finally got how to do some proper profiling while running the app :). The screenshot is after this boring text i will write.
-> the ui was blocked for like 10 seconds, as you can see on this SS(it happens on couple of different occasions -> i will describe these after the screenshot).
-> the page has router outlet with 2 navigation routes, one is a bit heavier of the other, it has levels of selectable items (for in for, items of items [ [item1, item,2] [item3 item4] [item5 item 6] ]). So for example when you click item 4 it updates the main array of items and if it is a leaf item that holds articles it sets the articles and shows the listView with articles (which is a repeat of article component)
-> the blockage on this page happens either on navigation from this router-outlet subpage to the other that is a bit simpler than this one or it happens when i play with these items and select different item on different level so it can show articles. Sometimes the ui blocks when i select an article of the list and a dialog opens (simple dialog).
the articles page (the 'heavier subpage') -> item-group and article are the components
the item-group component:
the article component is large but i have to link since i reuse it in other pages ():
so this was the huge text and i apologize for that but i had to link the markup (i will link the code that executes when clicking if needed);
And here is the screenshot of the profiling (you can notice where the app stopped and the ui blocked):
Dimitrievskislavcho commentedon May 25, 2017
i have tried the app on couple of different devices:
Cayan commentedon May 25, 2017
@Dimitrievskislavcho what did you use to profile?
I'm using developer tools and it's not as detailed as the one you provided.
I'll try to post some screenshots of mine later today.
Dimitrievskislavcho commentedon May 25, 2017
@Cayan i used the Android Monitor in Android Studio ...
the Monitors tab shows the mem, cpu, network and gpu stats over time.
First select the device/emulator and the app. Then you will be able to see the graphs.
If you struggle to find just see the Android Studio docs. There is a detailed info on how to setup so
you can do the profiling like i did.
note: if you cannot find the tools > android > android device monitor option in android studio,
try to map a shell android app (there are templates i think) and then you will see that option.
I didn't even use any code inside android studio, just the standalone android monitor option.
Cheers and i hope you will be able to do some proper profiling and finally we diagnose this weird problem.
Dimitrievskislavcho commentedon May 26, 2017
I've been contemplating and i thought of something that might be a reason. (i don't say it must be the reason :)). Angular's change detection. I use the Default strategy and that might be the problem looking from the perspective of how many detector calls are there from time to time. I will try to research some more and i will write if i manage to find something.
Cayan commentedon May 26, 2017
using OnPush improved the performance a lot for me
34 remaining items
carrbrpoa commentedon Mar 22, 2018
Hey @NickIliev, would be nice to see some user feedback (like UI loading, etc.) implemented in the sample project you mentioned. I installed it in my Galaxy S5 NEO and sometimes I touch an option and nothing happens - me, as a user, don't know if something is loading or not - but in some cases the action is fired some seconds after.
william-levi commentedon Jun 23, 2018
hi ! my app is also lagging for about 1-2 seconds..
but when it lags there is a message in console
Can anyone expalin me this console message..
ActivityManager: getContentProviderImpl: from caller=android.app.ApplicationThreadProxy@fabfd2f (pid=6121, userId=0) to get content provider settings cpr=ContentProviderRecord{62cae88 u0 com.android.providers.settings/.SettingsProvider} 06-23 23:28:24.198 6121 6121 D ActivityThread: holder:android.app.IActivityManager$ContentProviderHolder@dd49ae9, holder.provider:android.content.ContentProviderProxy@3ef236eThanks in advance guys ! Nativescript is awesome
[-]Nativescript + Angular 2 , "random" UI FREEZE and ANR issues![/-][+]Nativescript + Angular , "random" UI FREEZE and ANR issues![/+]NickIliev commentedon Dec 11, 2018
Closing this one as the general issue does not happen on our test apps with the latest modules and Angular. If anyone is still experiencing freeze issue please ping me so we could investigate the case and reopen this one if needed.
devlfm commentedon Jan 10, 2019
Hi all,
We are developing a big app with nativescript + angular, and the freezes are completely random.. sometimes opening modals, other times navigating or simply opening the drawer.. it's really disappointing because we wanted to use the same angular codebase for mobile/web apps, and we were very excited when we started last year developing with nativescript, but now we are not so sure if we made the right call :\ pls put more effort and don't give up on this issue..
I don't have the knowledge to fix or even understand the guts, but it feels to me that the livecycle gets broken/pending.. like the bridge between javascript & java gets blocked or something.. but its just a guess..
NickIliev commentedon Jan 11, 2019
@devlfm there is an experimental functionality which can greatly improve the described scenarios. The flag is called
markingMode. Details on the feature can be found in this article. and in this PRTo disable the
markingModein your NativeScript application open theapp/package.json(notice that this is not the root package.json but the one located inside the app folder) and add the following key:{ "android": { "markingMode": "none" } }Here is an example of how I am using the
markingModein this application (I am not experiencing any freezes or ANR)devlfm commentedon Jan 11, 2019
@NickIliev Thank you very much for pointing me out this! great reading.
I've been trying this flag, and truly stops the freezes! but at a cost of sometimes the app closes for no reason :(
Is there something I can avoid on code to prevent it? Or something I can use to detect GC errors?
This should be TOP priority for nativescript team! This flag should be by default on angular projects, as long as there are no issues with GC.
If you need something from me, just ask!
jeffswitzer commentedon Jan 11, 2019
Can second devlfm's comment. Turned marking mode on probably a year ago in a project and freezes were fixed, but the app then crashes quite frequently on android. Over the months I've been working on other projects hoping that the marking mode flag becomes more stable. I believe the following stack trace represents what commonly shows during a crash:
NickIliev commentedon Jan 14, 2019
@jeffswitzer @devlfm more on why the above error is happening here and also in this thread. The plugin's team has recently updated all NativeScript's owned plugin to be fully compatible with the experimental feature
markingModebut if your app uses other JS references to native Java objects, you will still need to preserve these references in the global object to prevent the GC from collecting them.jeffswitzer commentedon Jan 14, 2019
@NickIliev that is really great news about shoring up marking mode compatibility! I haven't tried 5.1 yet but will give it a shot and in the case that some plugins still give me fits will look towards the forthcoming documentation mentioned in the NS 5.1 release notes:
devlfm commentedon Jan 15, 2019
Hi @NickIliev , We are developing a photo/collage editor, and we use indeed some Glide implementations to handle image crop while drawing:
And I'm wondering if
return global.__native(this);on ctor isn't already locking this instance of beeing GC?I'll checkout what was done on plugins to see if I get it right.
Thank you
ppyoosuf commentedon Mar 13, 2019
i am having these issues as well. i tried the markingMode:"none",but it does not giving the good result .any idea to fix this one
lock commentedon Mar 12, 2020
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.