My app is seeing ANRs reported by user where the main thread has the following state. The state is "NATIVE" which means that it is executing native code but that it is not blocked. However, the stack shows IPCThreadState::waitForResponse. Does this mean that the thread is actually blocked? Or does it just mean that the stack trace happened to be taken when IPCThreadState::waitForResponse was executing, but the method is expected to complete shortly?
"main" prio=5 tid=1 Native | group="main" sCount=1 dsCount=0 obj=0x74bd52a0 self=0xb4db6500 | sysTid=17288 nice=-6 cgrp=default sched=0/0 handle=0xb6fa9b34 | state=S schedstat=( 6448302819 1899390895 16057 ) utm=511 stm=133 core=0 HZ=100 | stack=0xbe6a9000-0xbe6ab000 stackSize=8MB | held mutexes= kernel: (couldn't read /proc/self/task/17288/stack) native: #00 pc 00041d10 /system/lib/libc.so (__ioctl+8) native: #01 pc 000473c1 /system/lib/libc.so (ioctl+14) native: #02 pc 0001e7cd /system/lib/libbinder.so (android::IPCThreadState::talkWithDriver(bool)+132) native: #03 pc 0001edff /system/lib/libbinder.so (android::IPCThreadState::waitForResponse(android::Parcel*, int*)+38) native: #04 pc 0001efb5 /system/lib/libbinder.so (android::IPCThreadState::transact(int, unsigned int, android::Parcel const&, android::Parcel*, unsigned int)+124) native: #05 pc 00019fb7 /system/lib/libbinder.so (android::BpBinder::transact(unsigned int, android::Parcel const&, android::Parcel*, unsigned int)+30) native: #06 pc 00088301 /system/lib/libandroid_runtime.so (???) native: #07 pc 00d86509 /data/dalvik-cache/arm/system@[email protected] (Java_android_os_BinderProxy_transactNative__ILandroid_os_Parcel_2Landroid_os_Parcel_2I+140) at android.os.BinderProxy.transactNative(Native method) at android.os.BinderProxy.transact(Binder.java:503) at android.database.BulkCursorProxy.close(BulkCursorNative.java:214) at android.database.BulkCursorToCursorAdaptor.close(BulkCursorToCursorAdaptor.java:121) at android.database.CursorWrapper.close(CursorWrapper.java:50) at android.content.ContentResolver$CursorWrapperInner.close(ContentResolver.java:2512) at android.content.CursorLoader.onCanceled(CursorLoader.java:173) at android.content.CursorLoader.onCanceled(CursorLoader.java:171) at android.content.AsyncTaskLoader.dispatchOnCancelled(AsyncTaskLoader.java:240) at android.content.AsyncTaskLoader$LoadTask.onCancelled(AsyncTaskLoader.java:103) at android.os.AsyncTask.finish(AsyncTask.java:649) at android.os.AsyncTask.-wrap1(AsyncTask.java:-1) at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:668) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:148) at android.app.ActivityThread.main(ActivityThread.java:5417) at java.lang.reflect.Method.invoke!(Native method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616) When I get such ANRs, I do see that the CPU is under load. Is that the main problem and not my app (com.shri.myapp below)? Is there any way to see why system_server is using so much CPU? CPU usage from 0ms to 8354ms later: 63% 2071/system_server: 31% user + 32% kernel / faults: 9962 minor 129 major 14% 2225/com.android.systemui: 6.8% user + 7.1% kernel / faults: 6128 minor 38 major 12% 182/surfaceflinger: 4.9% user + 7.8% kernel / faults: 88 minor 1 major 12% 16128/kworker/0:3: 0% user + 12% kernel 12% 120/mmcqd/1: 0% user + 12% kernel 3.4% 17288/com.shri.myapp: 1.3% user + 2% kernel / faults: 2574 minor 90 major -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en --- You received this message because you are subscribed to the Google Groups "Android Developers" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.

