-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ANR in expo-updates in android on start up with large number of assets #19918
Comments
Hi there! It looks like your issue requires a minimal reproducible example, but it is invalid or absent. Please prepare such an example and share it in a new issue. The best way to get attention to your issue is to provide a clean and easy way for a developer to reproduce the issue on their own machine. Please do not provide your entire project, or a project with more code than is necessary to reproduce the issue. A side benefit of going through the process of narrowing down the minimal amount of code needed to reproduce the issue is that you may get lucky and discover that the bug is due to a mistake in your application code that you can quickly fix on your own. ResourcesCommon concerns"I've only been able to reproduce it in private, proprietary code"You may not have spent enough time narrowing down the root cause of the issue. Try out the techniques discussed in this manual debugging guide to learn how to isolate the problem from the rest of your codebase. "I didn't have time to create one"That's understandable, it can take some time to prepare. We ask that you hold off on filing an issue until you are able to fully complete the required fields in the issue template. "You can reproduce it by yourself by creating a project and following these steps"This is useful knowledge, but it's still valuable to have the resulting project that is produced from running the steps, where you have verified you can reproduce the issue. |
hi there! it's hard for us to help with the issue which we cannot reproduce. could you please create a minimal reproducible project and upload it to some git repositories? i'm happy to reopen and help then. btw, google play console should have an ANR report to show the stacktrace which causing the ANR. you could try to dig and share more information from it. |
This is not going to be possible. You are asking me to create an app, get
it in the Play Store, get thousands of people using it and to then push an
update that triggers when they have the app open.
I do not know how to reproduce it only guesses based on it occurring when a
new update is published to the store.
I can get you the ANR report as requested but whatever you are doing on
that event is too slow. Is there some way for me to disable that behavior
completely?
…On Tue, Nov 15, 2022 at 5:00 AM Kudo Chien ***@***.***> wrote:
hi there! it's hard for us to help with the issue which we cannot
reproduce. could you please create a minimal reproducible project and
upload it to some git repositories? i'm happy to reopen and help then.
btw, google play console should have an ANR report
<https://support.google.com/googleplay/android-developer/answer/9859174>
to show the stacktrace which causing the ANR. you could try to dig and
share more information from it.
—
Reply to this email directly, view it on GitHub
<#19918 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAC7RABKHLHUKTT26YXWUVLWIOCOLANCNFSM6AAAAAARZ45CLQ>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
i could understand it's hard to create an example or investigate issues that you cannot reproduce, and so do we. please share the ANR report details with us. the ANR report on google play should indicate the stacktrace of each thread. that's something we could further take a look. let's see if you we find something in the reports together. |
Unfortunately there is no ANR report download anymore. The original ANR messages are in the original bug report. My guess is it is actually not expo notifications but expo updates
The most likely culprit looking into this is my very large number of icons. My assets folder has 9,844 files in it, the vast majority being pngs with 2x and 3x versions. (64x64 128x128 192x192) |
@Kudo Ive looked through the code base in details and have a summary of what the issues are. If there is someone who works on expo-updates who I could speak with on Discord or via email that would be great, The core issue is the startup time for expo updates has a large number of synchronous calls that must complete before the app is loaded. If these calls take too long, this causes an ANR. I see most of the ANRs are on low end devices and also in background processing which makes sense. There exists a The first ANR is the above stack trace with the EmbeddedLoader.loadManifest when there is an update to be downloaded. Part of this is local and part of this can be skipped using The second ANR is the alternative branch that uses DatabaseLoader.initialize lines 86-96 which is used when initializing from the local disk This is a loop of file system calls on application start that causes an ANR with the number of assets I have. patch-package
So my action item for now is
Improving expo-updates to improve performance when using |
hi @celandro thanks for further investigating the diff. i can confirm the problem exist and i would like to reopen this issue and follow up with team. |
Thank you for filing this issue! |
Tracked in ENG-7652 |
# Why experimenting solution for expo-updates ANR mentioned in #19918 close ENG-7652 # How in #19918 case, the app has a large number of assets. when the app is updated from google play store, expo-updates will copy these assets from app internal storage (apk/aab) to file system and also doing database updates / asset checksums. that may take longer time. there is a main thread lock in [`UpdatesController.launchAssetFile`](https://github.com/expo/expo/blob/c0e29be13c8d012256bdd6fd2ec751f78a8ab7c6/packages/expo-updates/android/src/main/java/expo/modules/updates/UpdatesController.kt#L148) to wait for loading finish. it is the root cause of ANR. after visiting several ways toward the problem, this pr is my last attempt - to delay the call to react-native's `loadApp`. at this point, we can initialize expo-updates and do some heavy work in the background thread. since we don't call `setContentView(ReactRootView)`, expo-splash-screen will keep the splash screen showing. at this result, even splash screen is there, we can still send touch events and back key without ANR. ## Note the solution is getting a little tricky and is still experimenting. to disable this feature, please add `EX_UPDATES_ANDROID_DELAY_LOAD_APP=false` to gradle.properties. # Test Plan - ci passed - test eas update from the build geneated through `./gradlew :app:assembleRelease`
Summary
Receiving a large number of ANRs that look like:
This has my app sitting dangerously close to the 0.47% ANR bad behavior cutoff. It spikes to almost 3% when a new release is pushed to the play store.
What platform(s) does this occur on?
Android
Environment
expo-env-info 1.0.5 environment info:
Minimal reproducible example
This is a bare app that is a fairly heavy user of push notifications
The text was updated successfully, but these errors were encountered: