Closed notpeelz closed 1 year ago
It's hard to say unequivocally what is the cause of the ANR. The most likely root cause is the system webview your device uses. If you can, please share the traces file as described here, it might help to pinpoint the issue cause.
I tested the app with much bigger manifests though. For instance, airbnb app:
anr_2022-12-03-15-20-34-751.zip
Note that my phone is rooted, not sure if it could interfere with the webview. Custom ROM: LineageOS 18.1 (20220519-NIGHTLY-kebab) Magisk: 25.2 (with Zygisk) I also tried disabling most of my Magisk modules, but it didn't change anything.
Update:
If I disable the highlightjs javascript stuff, the issue goes away, so I used chrome://inspect
to remotely debug the WebView. I replaced highlight.pack.js
with the latest (unminified) version of highlightjs, then called hljs.highlightElement($('code'));
from the console and started stepping through the code. The page stays responsive the entire time, even after the DOM gets updated. The WebView only hangs once I completely exit the function and resume normal execution.
Trace file: trace_Sat_Dec_03_2022_9.18.45_PM.json.gz (you can open this with https://ui.perfetto.dev or chrome://tracing)
Here's a screenshot of the trace:
logcat output:
2022-12-03 21:17:36.307 24806-746 vitymanager.de com.activitymanager.dev I Thread[6,tid=746,WaitingInMainSignalCatcherLoop,Thread*=0xb4000076b11cabe0,peer=0x13d40110,"Signal Catcher"]: reacting to signal 3
2022-12-03 21:17:36.307 24806-746 vitymanager.de com.activitymanager.dev I
2022-12-03 21:17:36.421 24806-746 vitymanager.de com.activitymanager.dev I Wrote stack traces to tombstoned
2022-12-03 21:17:38.999 1783-29873 ActivityManager pid-1783 E ANR in com.activitymanager.dev (com.activitymanager.dev/com.sdex.activityrunner.manifest.ManifestViewerActivity)
PID: 24806
Reason: Input dispatching timed out (51e2c83 com.activitymanager.dev/com.sdex.activityrunner.manifest.ManifestViewerActivity (server) is not responding. Waited 5001ms for MotionEvent)
Parent: com.activitymanager.dev/com.sdex.activityrunner.manifest.ManifestViewerActivity
Load: 6.24 / 6.2 / 6.22
----- Output from /proc/pressure/memory -----
some avg10=0.00 avg60=0.00 avg300=0.00 total=246580
full avg10=0.00 avg60=0.00 avg300=0.00 total=99951
----- End output from /proc/pressure/memory -----
CPU usage from 19060ms to 0ms ago (2022-12-03 21:17:16.818 to 2022-12-03 21:17:35.878):
52% 24806/usap64: 50% user + 1.7% kernel / faults: 34807 minor
7.8% 2469/com.android.webview:sandboxed_process0:org.chromium.content.app.SandboxedProcessService0:0: 6.7% user + 1.1% kernel / faults: 9458 minor
6.4% 24814/adbd: 0.9% user + 5.4% kernel / faults: 14399 minor
1.7% 17147/kworker/u16:12-devfreq_wq: 0% user + 1.7% kernel
1.6% 1633/surfaceflinger: 0.9% user + 0.6% kernel / faults: 3 minor
1.4% 23447/kworker/u16:8-kgsl-mementry: 0% user + 1.4% kernel
1.4% 1783/system_server: 0.9% user + 0.4% kernel / faults: 1978 minor
1.1% 604/hwservicemanager: 0.9% user + 0.1% kernel
1% 28321/kworker/u16:1-memlat_wq: 0% user + 1% kernel
0.9% 1586/vendor.qti.hardware.display.composer-service: 0.4% user + 0.4% kernel
0.9% 3151/dp_rx_thread_0: 0% user + 0.9% kernel
0.5% 601/logd: 0.1% user + 0.4% kernel
0.5% 11/rcu_preempt: 0% user + 0.5% kernel
0.4% 12/rcu_sched: 0% user + 0.4% kernel
0.3% 14/rcuop/0: 0% user + 0.3% kernel
0.3% 15/rcuos/0: 0% user + 0.3% kernel
0.3% 32/rcuop/2: 0% user + 0.3% kernel
0.3% 544/crtc_commit:139: 0% user + 0.3% kernel
0.2% 33/rcuos/2: 0% user + 0.2% kernel
0.2% 4662/irq/16-90b6400.: 0% user + 0.2% kernel
0.2% 40/rcuop/3: 0% user + 0.2% kernel
0.2% 277/kgsl_worker_thr: 0% user + 0.2% kernel
0.2% 545/crtc_event:139: 0% user + 0.2% kernel
0.2% 655/android.hardware.atrace@1.0-service: 0% user + 0.1% kernel
0.2% 1363/netd: 0.1% user + 0% kernel / faults: 1 minor
0.1% 24/rcuop/1: 0% user + 0.1% kernel
0.1% 1577/vendor.pixelworks.hardware.display.iris-service: 0% user + 0.1% kernel
0.1% 10/ksoftirqd/0: 0% user + 0.1% kernel
0.1% 25/rcuos/1: 0% user + 0.1% kernel
0.1% 41/rcuos/3: 0% user + 0.1% kernel
0.1% 2073/msm_irqbalance: 0% user + 0% kernel
0.1% 3465/com.android.phone: 0% user + 0% kernel / faults: 3 minor
0.1% 4673/irq/17-9091000.: 0% user + 0.1% kernel
0.1% 14278/kworker/3:1-mm_percpu_wq: 0% user + 0.1% kernel
0.1% 23451/kworker/0:1-events: 0% user + 0.1% kernel
0.1% 26029/logcat: 0% user + 0% kernel
0% 29/ksoftirqd/2: 0% user + 0% kernel
0% 48/rcuop/4: 0% user + 0% kernel
0% 49/rcuos/4: 0% user + 0% kernel
0% 56/rcuop/5: 0% user + 0% kernel
0% 57/rcuos/5: 0% user + 0% kernel
0% 64/rcuop/6: 0% user + 0% kernel
0% 94/qmp_aop: 0% user + 0% kernel
0% 603/servicemanager: 0% user + 0% kernel
0% 767/lspd: 0% user + 0% kernel
0% 2944/usap64: 0% user + 0% kernel / faults: 3 minor
0% 3140/scheduler_threa: 0% user + 0% kernel
0% 3193/com.android.networkstack.process: 0% user + 0% kernel / faults: 14 minor
0% 5040/com.android.systemui: 0% user + 0% kernel
0% 6386/com.x8bit.bitwarden: 0% user + 0% kernel / faults: 1 minor
0% 6441/com.mi.android.globallauncher: 0% user + 0% kernel / faults: 3 minor
0% 7206/com.google.android.youtube: 0% user + 0% kernel / faults: 2 minor
0% 7716/kworker/2:1-events: 0% user + 0% kernel
0% 10658/kworker/1:1-pm: 0% user + 0% kernel
0% 12634/kworker/u17:0: 0% user + 0% kernel
0% 15243/irq/546-touchpa: 0% user + 0% kernel
0% 16073/kworker/1:2-events: 0% user + 0% kernel
0% 20310/com.android.launcher3: 0% user + 0% kernel / faults: 4 minor
0% 21268/kworker/u17:2-kgsl-events: 0% user + 0% kernel
0% 21269/kworker/u17:3-kgsl-events: 0% user + 0% kernel
0% 32549/transport: 0% user + 0% kernel
2022-12-03 21:17:38.999 1783-29873 ActivityManager pid-1783 E +0% 28952/kworker/6:0-mm_percpu_wq: 0% user + 0% kernel
19% TOTAL: 12% user + 6.4% kernel + 0.4% irq + 0.3% softirq
CPU usage from 61ms to 410ms later (2022-12-03 21:17:35.939 to 2022-12-03 21:17:36.288):
97% 24806/com.activitymanager.dev: 97% user + 0% kernel
101% 24806/vitymanager.dev: 101% user + 0% kernel
33% 1783/system_server: 16% user + 16% kernel / faults: 645 minor
30% 29873/AnrConsumer: 13% user + 16% kernel
8.9% 24814/adbd: 0% user + 8.9% kernel / faults: 223 minor
4.4% 24814/adbd: 0% user + 4.4% kernel
+0% 29919/shell svc 29918: 0% user + 0% kernel
2.9% 64/rcuop/6: 0% user + 2.9% kernel
28% TOTAL: 20% user + 7.8% kernel + 0.3% irq + 0.3% softirq
2022-12-03 21:17:54.774 24806-24806 Choreographer com.activitymanager.dev I Skipped 3244 frames! The application may be doing too much work on its main thread.
Thanks for the detailed report! I've updated the highlightjs library in #20. Could you check it? I see that you already build the app from the source code, so I suppose it won't be a problem.
The problem doesn't seem to be JavaScript-related. I apologize if I mislead you. I only switched to an unminified version of hljs so it would be easier to see if the JavaScript code was causing the ANR.
Here's a video that demonstrates the issue better: https://i.imgur.com/hLXeWjw.mp4 (recorded on 8a1c9b3bf6840abfbe0daed965c67143a425e607)
Like you mentioned earlier, I'm thinking this is a bug with my phone's WebView (/product/app/webview/webview.apk
). Is this something that Google can fix via a Play Store update, or would I have to update my Android install?
Update: I was able to fix it by switching to a 3rd-party WebView. Feel free to close this issue. Thanks again for your help :)
Great, thanks for the update!
FYI, there is the magisk module to change the system WebView.
When I open the manifest viewer, the app becomes unresponsive for several seconds, sometimes even several minutes if the manifest is really big. The initial render seems to display the manifest just fine but I can't scroll at all and usually get the "Activity Manager isn't responding" prompt.
Android version: 11 Activity Manager version: 5.2.1 Tested with these packages:
org.mozilla.fenix
: hangs for ~25-30scom.google.android.apps.photos
): had to kill the app after a couple minutes