Android-inapp-billing-v3: ANR - Input dispatching timed out

Created on 10 Feb 2018  路  6Comments  路  Source: anjlab/android-inapp-billing-v3

Hi,

We get ANRs (0.6% of all sessions) for our live app but we have not been able to reproduce it. It appears on "all" Android versions (some overrepresentation in Android 8.0 ) and for a wide range of devices. I read that you have had a similar issue, blocking the main thread, and solved it with a creation of a new async thread. So what could be causing this? We are using version 1.0.44. See the ANR log below. I guess you will need more information about our implementation to find the bug. I will ask my friend, who implemented the code, to provide you with more details.

Thanks!

Input dispatching timed out (Waiting to send non-key event because the touched window has not finished processing certain input events that were delivered to it over 500.0ms ago. Wait queue length: 6. Wait queue head age: 5867.0ms.

"main" prio=5 tid=1 Native
  | group="main" sCount=1 dsCount=0 obj=0x75ebb000 self=0xb704bba0
  | sysTid=28775 nice=0 cgrp=apps sched=0/0 handle=0xb6fa1ec8
  | state=S schedstat=( 1251530264 134019166 940 ) utm=104 stm=21 core=3 HZ=100
  | stack=0xbe426000-0xbe428000 stackSize=8MB
  | held mutexes=
  #00  pc 00000000000394e0  /system/lib/libc.so (__ioctl+8)
  #01  pc 000000000003f415  /system/lib/libc.so (ioctl+14)
  #02  pc 000000000001cbbb  /system/lib/libbinder.so (_ZN7android14IPCThreadState14talkWithDriverEb+138)
  #03  pc 000000000001d1d7  /system/lib/libbinder.so (_ZN7android14IPCThreadState15waitForResponseEPNS_6ParcelEPi+42)
  #04  pc 000000000001d379  /system/lib/libbinder.so (_ZN7android14IPCThreadState8transactEijRKNS_6ParcelEPS1_j+124)
  #05  pc 000000000001860f  /system/lib/libbinder.so (_ZN7android8BpBinder8transactEjRKNS_6ParcelEPS1_j+30)
  #06  pc 0000000000087923  /system/lib/libandroid_runtime.so (???)
  #07  pc 0000000000c116e1  /system/framework/arm/boot.oat (Java_android_os_BinderProxy_transactNative__ILandroid_os_Parcel_2Landroid_os_Parcel_2I+144)
  at android.os.BinderProxy.transactNative (BinderProxy.java)
  at android.os.BinderProxy.transact (BinderProxy.java:496)
  at com.android.vending.billing.IInAppBillingService$Stub$Proxy.getSkuDetails (IInAppBillingService.java:370)
  at com.anjlab.android.iab.v3.BillingProcessor.getSkuDetails (BillingProcessor.java:826)
  at com.anjlab.android.iab.v3.BillingProcessor.getSkuDetails (BillingProcessor.java:810)
  at com.anjlab.android.iab.v3.BillingProcessor.getPurchaseListingDetails (BillingProcessor.java:866)
  or                     .onBillingInitialized (BillingProcessor.java:866)
  at com.anjlab.android.iab.v3.BillingProcessor$HistoryInitializationTask.onPostExecute (BillingProcessor.java:121)
  at android.os.AsyncTask.finish (AsyncTask.java:632)
  at android.os.AsyncTask.access$600 (AsyncTask.java:177)
  at android.os.AsyncTask$InternalHandler.handleMessage (AsyncTask.java:645)
  at android.os.Handler.dispatchMessage (Handler.java:102)
  at android.os.Looper.loop (Looper.java:135)
  at android.app.ActivityThread.main (ActivityThread.java:5753)
  at java.lang.reflect.Method.invoke! (Native method)
  at java.lang.reflect.Method.invoke (Method.java:372)
  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:1405)
  at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1200)

Most helpful comment

+2

All 6 comments

+1

+1

+1

+2

+1

Your issue is occurring in onPostExecute of your AsyncTask, which means it's happening on the main thread. You should call _all_ billing processor methods on an IO thread to avoid blocking your main thread.

There are literally too many possible ways to do this to describe succinctly. AsyncTasks, RxJava, Kotlin coroutines, vanilla Threads, Android Services....

Was this page helpful?
0 / 5 - 0 ratings

Related issues

FranciscoE-Hudl picture FranciscoE-Hudl  路  9Comments

KRIPT4 picture KRIPT4  路  3Comments

goldfish07 picture goldfish07  路  8Comments

mattiaferigutti picture mattiaferigutti  路  6Comments

AdityaAnand1 picture AdityaAnand1  路  6Comments