Getting some ANR's from google admob rewarded ads v16 on Unity game

405 views
Skip to first unread message

kevin

unread,
Jun 10, 2019, 3:05:37 PM6/10/19
to Google Mobile Ads SDK Developers
Hi,
   I have been receiving ANR's from admob rewarded ads v16 on Unity game.  While admob rewarded ads typically play fine, here are some ANR exceptions.
Looks like happening in the finalizer daemon:


----------------------------------------------------------------------------------------------
"main" prio=5 tid=1 Blocked
  | group="main" sCount=1 dsCount=0 obj=0x73e74f30 self=0xa6705400
  | sysTid=11356 nice=-4 cgrp=default sched=0/0 handle=0xa9395534
  | state=S schedstat=( 0 0 0 ) utm=9804 stm=3566 core=3 HZ=100
  | stack=0xbe17f000-0xbe181000 stackSize=8MB
  | held mutexes=
 
  at com.google.android.gms.ads.internal.webview.v.E (com.google.android.gms.policy_ads_fdr_dynamite@20290000@20290000.249178941.249178941)
- waiting to lock <0x0af43b1e> (a com.google.android.gms.ads.internal.webview.v) held by thread 7
  at com.google.android.gms.ads.internal.webview.t.E (com.google.android.gms.policy_ads_fdr_dynamite@20290000@20290000.249178941.249178941:8)
  at com.google.android.gms.ads.internal.webview.j.onPageFinished (com.google.android.gms.policy_ads_fdr_dynamite@20290000@20290000.249178941.249178941:2)
- locked <0x0b347fff> (a java.lang.Object)
  at vl.d (PG:307)
  at aHZ.handleMessage (PG:72)
  at android.os.Handler.dispatchMessage (Handler.java:102)
  at android.os.Looper.loop (Looper.java:154)
  at android.app.ActivityThread.main (ActivityThread.java:6153)
  at java.lang.reflect.Method.invoke! (Native method)
  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:865)
  at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:755)

"FinalizerDaemon" daemon prio=5 tid=7 Blocked
  | group="system" sCount=1 dsCount=0 obj=0x12c549d0 self=0x9dcd7b00
  | sysTid=11364 nice=0 cgrp=default sched=0/0 handle=0xa5b23920
  | state=S schedstat=( 0 0 0 ) utm=32 stm=7 core=3 HZ=100
  | stack=0xa5a21000-0xa5a23000 stackSize=1038KB
  | held mutexes=
 
  at com.google.android.gms.ads.internal.webview.j.k (com.google.android.gms.policy_ads_fdr_dynamite@20290000@20290000.249178941.249178941:3)
- waiting to lock <0x0b347fff> (a java.lang.Object) held by thread 1
  at com.google.android.gms.ads.internal.webview.v.destroy (com.google.android.gms.policy_ads_fdr_dynamite@20290000@20290000.249178941.249178941:4)
- locked <0x0af43b1e> (a com.google.android.gms.ads.internal.webview.v)
  at com.google.android.gms.ads.internal.webview.t.destroy (com.google.android.gms.policy_ads_fdr_dynamite@20290000@20290000.249178941.249178941:10)
  at com.google.android.gms.ads.nonagon.ad.rewardedvideo.c.finalize (com.google.android.gms.policy_ads_fdr_dynamite@20290000@20290000.249178941.249178941:2)
  at java.lang.Daemons$FinalizerDaemon.doFinalize (Daemons.java:224)
  at java.lang.Daemons$FinalizerDaemon.run (Daemons.java:211)
  at java.lang.Thread.run (Thread.java:761)

Mobile Ads SDK Forum Advisor Prod

unread,
Jun 10, 2019, 5:44:54 PM6/10/19
to kka...@gmail.com, google-adm...@googlegroups.com
Hello there,

Can you please update the SDK to the latest version and let us know the frequency of these ANRs with the latest version

Regards,
Deepika Uragayala
Mobile Ads SDK Team

ref:_00D1U1174p._5001UBmYNO:ref

Ville Mäkynen

unread,
Jun 12, 2019, 6:17:10 AM6/12/19
to Google Mobile Ads SDK Developers
ANRs with the same stack trace started appearing in my Google Play Console on around June 4. I can't say what the exact frequency of them is, but it is the most common ANR in the latest version of my app and likely will have a significant effect on Android Vitals.

The ANRs started appearing without me having updated the app in almost two months - zero occurences before these dates and now there are dozens daily. I have since updated the app (on June 9) to use the latest mobile ads SDK (play-services-ads:17.2.1) and the latest Android SDK (28), but the same ANRs appear in the updated app as well, so I don't think it's necessarily an issue with the SDKs.

I have found a simple way to reproduce something that looks related locally. The ANR is caused by the two threads getting deadlocked and this is a way to reproduce a case where a webview method is called on a wrong thread, with a similar stack trace. It seems like a likely culprit.

If you have variable 'InterstitialAd interstitial' and load an ad into it but don't display it, and then later set 'interstitial = null' to let it be GC'd, it apparently gets stuck somehow. Now if you put the app into background, after a few seconds you can see this in Logcat:

2019-06-12 12:10:24.305 5071-5088/com.example.app W/WebView: java.lang.Throwable: A WebView method was called on thread 'FinalizerDaemon'. All WebView methods must be called on the same thread. (Expected Looper Looper (main, tid 2) {e15b91b} called on null, FYI main Looper is Looper (main, tid 2) {e15b91b})
        at android.webkit.WebView.checkThread(WebView.java:2695)
        at android.webkit.WebView.loadUrl(WebView.java:969)
        at com.google.android.gms.ads.internal.webview.v.e(:com.google.android.gms.policy_ads_fdr_dynamite@20290000@20290000.249178941.249178941:1)
        at com.google.android.gms.ads.internal.webview.v.destroy(:com.google.android.gms.policy_ads_fdr_dynamite@20290000@20290000.249178941.249178941:9)
        at com.google.android.gms.ads.internal.webview.t.destroy(:com.google.android.gms.policy_ads_fdr_dynamite@20290000@20290000.249178941.249178941:10)
        at com.google.android.gms.ads.nonagon.ad.interstitial.b.finalize(:com.google.android.gms.policy_ads_fdr_dynamite@20290000@20290000.249178941.249178941:2)
        at java.lang.Daemons$FinalizerDaemon.doFinalize(Daemons.java:250)
        at java.lang.Daemons$FinalizerDaemon.runInternal(Daemons.java:237)
        at java.lang.Daemons$Daemon.run(Daemons.java:103)
        at java.lang.Thread.run(Thread.java:764)
2019-06-12 12:10:24.343 5071-5088/com.example.app D/StrictMode: StrictMode policy violation: android.os.strictmode.WebViewMethodCalledOnWrongThreadViolation
        at android.webkit.WebView.checkThread(WebView.java:2695)
        at android.webkit.WebView.loadUrl(WebView.java:969)
        at com.google.android.gms.ads.internal.webview.v.e(:com.google.android.gms.policy_ads_fdr_dynamite@20290000@20290000.249178941.249178941:1)
        at com.google.android.gms.ads.internal.webview.v.destroy(:com.google.android.gms.policy_ads_fdr_dynamite@20290000@20290000.249178941.249178941:9)
        at com.google.android.gms.ads.internal.webview.t.destroy(:com.google.android.gms.policy_ads_fdr_dynamite@20290000@20290000.249178941.249178941:10)
        at com.google.android.gms.ads.nonagon.ad.interstitial.b.finalize(:com.google.android.gms.policy_ads_fdr_dynamite@20290000@20290000.249178941.249178941:2)
        at java.lang.Daemons$FinalizerDaemon.doFinalize(Daemons.java:250)
        at java.lang.Daemons$FinalizerDaemon.runInternal(Daemons.java:237)
        at java.lang.Daemons$Daemon.run(Daemons.java:103)
        at java.lang.Thread.run(Thread.java:764)
2019-06-12 12:10:24.345 5071-5088/com.example.app W/Ads: Could not call loadUrl. 
    java.lang.RuntimeException: java.lang.Throwable: A WebView method was called on thread 'FinalizerDaemon'. All WebView methods must be called on the same thread. (Expected Looper Looper (main, tid 2) {e15b91b} called on null, FYI main Looper is Looper (main, tid 2) {e15b91b})
        at android.webkit.WebView.checkThread(WebView.java:2700)
        at android.webkit.WebView.loadUrl(WebView.java:969)
        at com.google.android.gms.ads.internal.webview.v.e(:com.google.android.gms.policy_ads_fdr_dynamite@20290000@20290000.249178941.249178941:1)
        at com.google.android.gms.ads.internal.webview.v.destroy(:com.google.android.gms.policy_ads_fdr_dynamite@20290000@20290000.249178941.249178941:9)
        at com.google.android.gms.ads.internal.webview.t.destroy(:com.google.android.gms.policy_ads_fdr_dynamite@20290000@20290000.249178941.249178941:10)
        at com.google.android.gms.ads.nonagon.ad.interstitial.b.finalize(:com.google.android.gms.policy_ads_fdr_dynamite@20290000@20290000.249178941.249178941:2)
        at java.lang.Daemons$FinalizerDaemon.doFinalize(Daemons.java:250)
        at java.lang.Daemons$FinalizerDaemon.runInternal(Daemons.java:237)
        at java.lang.Daemons$Daemon.run(Daemons.java:103)
        at java.lang.Thread.run(Thread.java:764)
     Caused by: java.lang.Throwable: A WebView method was called on thread 'FinalizerDaemon'. All WebView methods must be called on the same thread. (Expected Looper Looper (main, tid 2) {e15b91b} called on null, FYI main Looper is Looper (main, tid 2) {e15b91b})
        at android.webkit.WebView.checkThread(WebView.java:2695)
        at android.webkit.WebView.loadUrl(WebView.java:969) 
        at com.google.android.gms.ads.internal.webview.v.e(:com.google.android.gms.policy_ads_fdr_dynamite@20290000@20290000.249178941.249178941:1) 
        at com.google.android.gms.ads.internal.webview.v.destroy(:com.google.android.gms.policy_ads_fdr_dynamite@20290000@20290000.249178941.249178941:9) 
        at com.google.android.gms.ads.internal.webview.t.destroy(:com.google.android.gms.policy_ads_fdr_dynamite@20290000@20290000.249178941.249178941:10) 
        at com.google.android.gms.ads.nonagon.ad.interstitial.b.finalize(:com.google.android.gms.policy_ads_fdr_dynamite@20290000@20290000.249178941.249178941:2) 
        at java.lang.Daemons$FinalizerDaemon.doFinalize(Daemons.java:250) 
        at java.lang.Daemons$FinalizerDaemon.runInternal(Daemons.java:237) 
        at java.lang.Daemons$Daemon.run(Daemons.java:103) 
        at java.lang.Thread.run(Thread.java:764) 

I tried this on two devices and was able to reproduce it on both:
- Nokia 6.1, Android version 9.0
- Xiaomi Redmi Note 5A, Android version 7.1.2

The issue can be reproduced with the test interstitial and video ad units:
- Test Interstitial: ca-app-pub-3940256099942544/1033173712
- Test Interstitial Video: ca-app-pub-3940256099942544/8691691433

Mobile Ads SDK Forum Advisor Prod

unread,
Jun 12, 2019, 1:40:16 PM6/12/19
to makv...@gmail.com, google-adm...@googlegroups.com

Hello there,

Thank you for providing additional details. I will share this with the rest of the team for further investigation and I will get back to you if I need any other information or If I have an update from our team.



Regards,
Deepika Uragayala
Mobile Ads SDK Team



ref:_00D1U1174p._5001UBmYNO:ref
Reply all
Reply to author
Forward
0 new messages