question

Carlos avatar image
Carlos asked

Getting an ANR pretty often

I have a lot of reports of this ANR: JNI: CheckJNI is off; workarounds are off; pins=9; globals=516 (plus 247 weak) DALVIK THREADS: (mutexes: tll=0 tsl=0 tscl=0 ghl=0) "main" prio=5 tid=1 NATIVE | group="main" sCount=1 dsCount=0 obj=0x416e5ea0 self=0x415df778 | sysTid=7028 nice=0 sched=0/0 cgrp=apps handle=1074000212 | state=S schedstat=( 0 0 0 ) utm=4560 stm=1059 core=0 #00 pc 00021aa8 /system/lib/ libc.so (__futex_syscall3+8) #01 pc 0000e814 /system/lib/ libc.so #02 pc 0019db27 /system/lib/ libwebviewchromium.so #03 pc 0019e061 /system/lib/ libwebviewchromium.so #04 pc 00020d8c /system/lib/ libdvm.so (dvmPlatformInvoke+112) #05 pc 00051ae7 /system/lib/ libdvm.so (dvmCallJNIMethod(unsigned int const*, JValue*, Method const*, Thread*)+398) #06 pc 0002a220 /system/lib/ libdvm.so #07 pc 000316d0 /system/lib/ libdvm.so (dvmMterpStd(Thread*)+76) #08 pc 0002ed68 /system/lib/ libdvm.so (dvmInterpret(Thread*, Method const*, JValue*)+184) #09 pc 00064319 /system/lib/ libdvm.so (dvmInvokeMethod(Object*, Method const*, ArrayObject*, ArrayObject*, ClassObject*, bool)+392) #10 pc 0006c37f /system/lib/ libdvm.so #11 pc 0002a220 /system/lib/ libdvm.so #12 pc 000316d0 /system/lib/ libdvm.so (dvmMterpStd(Thread*)+76) #13 pc 0002ed68 /system/lib/ libdvm.so (dvmInterpret(Thread*, Method const*, JValue*)+184) #14 pc 00064035 /system/lib/ libdvm.so (dvmCallMethodV(Thread*, Method const*, Object*, bool, JValue*, std::__va_list)+336) #15 pc 0004d617 /system/lib/ libdvm.so #16 pc 000521c7 /system/lib/ libandroid_runtime.so #17 pc 0005375b /system/lib/ libandroid_runtime.so (android::AndroidRuntime::start(char const*, char const*)+354) #18 pc 0000105b /system/bin/app_process #19 pc 0000e4f3 /system/lib/ libc.so (__libc_init+50) #20 pc 00000d7c /system/bin/app_process at com.android.org.chromium.android_webview.AwCookieManager.nativeSetCookie(Native Method) at com.android.org.chromium.android_webview.AwCookieManager.setCookie(AwCookieManager.java:46) at com.android.webview.chromium.CookieManagerAdapter.setCookie(CookieManagerAdapter.java:49) at com.amazon.device.ads.WebViewFactory$MobileAdsCookieManager.setCookie(WebViewFactory.java:222) at com.amazon.device.ads.WebViewFactory.updateAdIdCookie(WebViewFactory.java:93) at com.amazon.device.ads.WebViewFactory.createWebView(WebViewFactory.java:72) at com.amazon.device.ads.ViewManager.createWebView(ViewManager.java:214) at com.amazon.device.ads.ViewManager.getCurrentWebView(ViewManager.java:96) at com.amazon.device.ads.ViewManager.initialize(ViewManager.java:84) at com.amazon.device.ads.AdContainer.initialize(AdContainer.java:68) at com.amazon.device.ads.AdController.initializeAdContainer(AdController.java:914) at com.amazon.device.ads.AdController.initialize(AdController.java:843) at com.amazon.device.ads.AdSlot.initializeAd(AdSlot.java:109) at com.amazon.device.ads.AdLoader.finalizeFetchAd(AdLoader.java:424) at com.amazon.device.ads.AdLoader$2.run(AdLoader.java:115) at android.os.Handler.handleCallback(Handler.java:733) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:146) at android.app.ActivityThread.main(ActivityThread.java:5487) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:515) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1283) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1099) at dalvik.system.NativeStart.main(Native Method)
mobile ads
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Andrew@Amazon avatar image
Andrew@Amazon answered
Hi Carlos, Do you happen to be using CookieManager anywhere in your application, or know if perhaps another library your app uses may be using it? Also, do you have any statistics that may be helpful, such as certain versions of Android this is occurring on? Android has had deadlocks in CookieManager in the past, so I'm trying to determine if this may be related.
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Carlos avatar image
Carlos answered
My app has a browser in it and I use the CookieManager extensively. So yeah, the ANR could totally be from that, I've seen those myself. I can't find the ANR report anymore but I'll keep looking to see if I find it again and get you those version numbers. Thanks.
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Andrew@Amazon avatar image
Andrew@Amazon answered
Okay, thanks Carlos. That sounds like it could be the issue, then, and your use of the CookieManager would explain why we have not had other developers run into the same issue. We will look into if there's anything we can do on our side to prevent the deadlock.
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Carlos avatar image
Carlos answered
I just found the ANR again and it seems to be android 4.4. I know the CookieManager locks up like crazy on 4.4. I used to use it inside shouldIntercept but it started locking up on 4.4.
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Ross@Amazon avatar image
Ross@Amazon answered
The Mobile Ads SDK team will look into this issue. If you have any updates please let us know (e.g. if you start seeing the issue on more recent versions of Android).
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.