Android ANR error - android

I am using android service by calling startService(), and at the same time, I bind the service to activity to communicate with it through messengers.
I got this error when I quit the app after playing around.
I checked the /data/anr/traces.txt, it like this:
"main" prio=5 tid=1 NATIVE
10 | group="main" sCount=1 dsCount=0 obj=0x40fae508 self=0x40f67b78
11 | sysTid=11746 nice=0 sched=0/0 cgrp=apps handle=1074597680
12 | schedstat=( 2272796932 1135546599 7858 ) utm=175 stm=51 core=3
13 #00 pc 0000da70 /system/lib/libc.so (epoll_wait+12)
14 #01 pc 00014899 /system/lib/libutils.so (android::Looper::pollInner(int)+96)
15 #02 pc 00014b01 /system/lib/libutils.so (android::Looper::pollOnce(int, int*, int*, void**)+104)
16 #03 pc 00063653 /system/lib/libandroid_runtime.so (android::NativeMessageQueue::pollOnce(_JNIEnv*, int)+22)
17 #04 pc 0001deb0 /system/lib/libdvm.so (dvmPlatformInvoke+112)
18 #05 pc 0004d103 /system/lib/libdvm.so (dvmCallJNIMethod(unsigned int const*, JValue*, Method const*, Thread*)+394)
19 #06 pc 000272e0 /system/lib/libdvm.so
20 #07 pc 0002bbe8 /system/lib/libdvm.so (dvmInterpret(Thread*, Method const*, JValue*)+180)
21 #08 pc 0005fb37 /system/lib/libdvm.so (dvmInvokeMethod(Object*, Method const*, ArrayObject*, ArrayObject*, ClassObject*, bool)+374)
22 #09 pc 000670e5 /system/lib/libdvm.so
23 #10 pc 000272e0 /system/lib/libdvm.so
24 #11 pc 0002bbe8 /system/lib/libdvm.so (dvmInterpret(Thread*, Method const*, JValue*)+180)
25 #12 pc 0005f871 /system/lib/libdvm.so (dvmCallMethodV(Thread*, Method const*, Object*, bool, JValue*, std::__va_list)+272)
26 #13 pc 000496f3 /system/lib/libdvm.so
27 #14 pc 0004c571 /system/lib/libandroid_runtime.so
28 #15 pc 0004d6d3 /system/lib/libandroid_runtime.so (android::AndroidRuntime::start(char const*, char const*)+390)
29 #16 pc 00000dcf /system/bin/app_process
30 #17 pc 00017123 /system/lib/libc.so (__libc_init+38)
31 #18 pc 00000b34 /system/bin/app_process
32 at android.os.MessageQueue.nativePollOnce(Native Method)
33 at android.os.MessageQueue.next(MessageQueue.java:125)
34 at android.os.Looper.loop(Looper.java:124)
35 at android.app.ActivityThread.main(ActivityThread.java:4898)
36 at java.lang.reflect.Method.invokeNative(Native Method)
37 at java.lang.reflect.Method.invoke(Method.java:511)
38 at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1006)
39 at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:773)
40 at dalvik.system.NativeStart.main(Native Method)

Related

Android 4.4 crash signal 11 (SIGSEGV), code 1 (SEGV_MAPERR) StringObject::utfLength() const

Facing this issue. Unable to reproduce but getting these crashes in google play console after our latest release. Please help. Only effecting Android 4.4. More than 1700 reports this week.
signal 11 (SIGSEGV), code 1 (SEGV_MAPERR)
StringObject::utfLength() const
backtrace:
native: pc 000000000005596c /system/lib/libdvm.so (StringObject::utfLength() const+17)
native: pc 000000000004b6e5 /system/lib/libdvm.so
native: pc 0000000000017341 /system/lib/libjavacore.so
native: pc 00000000000174e7 /system/lib/libjavacore.so
native: pc 000000000001dd8c /system/lib/libdvm.so (dvmPlatformInvoke+112)
native: pc 000000000004e253 /system/lib/libdvm.so (dvmCallJNIMethod(unsigned int const*, JValue*, Method const*, Thread*)+398)
native: pc 00000000000271a0 /system/lib/libdvm.so
native: pc 000000000002e150 /system/lib/libdvm.so (dvmMterpStd(Thread*)+76)
native: pc 000000000002b7fc /system/lib/libdvm.so (dvmInterpret(Thread*, Method const*, JValue*)+184)
native: pc 0000000000060843 /system/lib/libdvm.so (dvmCallMethodV(Thread*, Method const*, Object*, bool, JValue*, std::__va_list)+338)
native: pc 0000000000060867 /system/lib/libdvm.so (dvmCallMethod(Thread*, Method const*, Object*, JValue*, ...)+20)
native: pc 0000000000055547 /system/lib/libdvm.so
native: pc 000000000000d280 /system/lib/libc.so (__thread_entry+72)
native: pc 000000000000d41c /system/lib/libc.so (pthread_create+240)

Android ClassLoader.loadClass JNI crash

signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr deadd00d
#00 pc 0x50f8e /system/lib/libdvm.so (dvmAbort+89)
#01 pc 0x59ee1 /system/lib/libdvm.so (dvmLinearAlloc(Object*, unsigned int)+64)
#02 pc 0x76a7b /system/lib/libdvm.so (???)
#03 pc 0x76d77 /system/lib/libdvm.so (dvmDefineClass(DvmDex*, char const*, Object*)+10)
#04 pc 0x71583 /system/lib/libdvm.so (???)
#05 pc 0x30c0c /system/lib/libdvm.so (???)
#06 pc 0x343dc /system/lib/libdvm.so (dvmInterpret(Thread*, Method const*, JValue*)+184)
#07 pc 0x6d109 /system/lib/libdvm.so (dvmCallMethodV(Thread*, Method const*, Object*, bool, JValue*, std::__va_list)+284)
#08 pc 0x6d12d /system/lib/libdvm.so (dvmCallMethod(Thread*, Method const*, Object*, JValue*, ...)+20)
#09 pc 0x76e69 /system/lib/libdvm.so (dvmFindClassNoInit(char const*, Object*)+108)
#10 pc 0x6216b /system/lib/libdvm.so (???)
#11 pc 0x62287 /system/lib/libdvm.so (???)
#12 pc 0x65a6d /system/lib/libdvm.so (dvmVerifyCodeFlow(VerifierData*)+9760)
#13 pc 0x68c91 /system/lib/libdvm.so (???)
#14 pc 0x68ce3 /system/lib/libdvm.so (dvmVerifyClass(ClassObject*)+42)
#15 pc 0x7704d /system/lib/libdvm.so (dvmInitClass+116)
#16 pc 0x742d1 /system/lib/libdvm.so (???)
#17 pc 0x30c0c /system/lib/libdvm.so (???)
#18 pc 0x343dc /system/lib/libdvm.so (dvmInterpret(Thread*, Method const*, JValue*)+184)
#19 pc 0x6ce39 /system/lib/libdvm.so (dvmInvokeMethod(Object*, Method const*, ArrayObject*, ArrayObject*, ClassObject*, bool)+344)
#20 pc 0x73b19 /system/lib/libdvm.so (???)
#21 pc 0x30c0c /system/lib/libdvm.so (???)
#22 pc 0x343dc /system/lib/libdvm.so (dvmInterpret(Thread*, Method const*, JValue*)+184)
#23 pc 0x6ce39 /system/lib/libdvm.so (dvmInvokeMethod(Object*, Method const*, ArrayObject*, ArrayObject*, ClassObject*, bool)+344)
#24 pc 0x7431b /system/lib/libdvm.so (???)
#25 pc 0x30c0c /system/lib/libdvm.so (???)
#26 pc 0x343dc /system/lib/libdvm.so (dvmInterpret(Thread*, Method const*, JValue*)+184)
#27 pc 0x6d109 /system/lib/libdvm.so (dvmCallMethodV(Thread*, Method const*, Object*, bool, JValue*, std::__va_list)+284)
#28 pc 0x554af /system/lib/libdvm.so (???)
#29 pc 0x48c6b /system/lib/libandroid_runtime.so (???)
#30 pc 0x4a81f /system/lib/libandroid_runtime.so (android::AndroidRuntime::start(char const*, char const*)+394)
#31 pc 0xf0d /system/bin/app_process (???)
java.lang.Throwable:
******* Java stack for JNI crash *******
at dalvik.system.DexFile.defineClass(Native Method)
at dalvik.system.DexFile.loadClassBinaryName(DexFile.java:195)
at dalvik.system.DexPathList.findClass(DexPathList.java:315)
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:58)
at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.lily.dexLoader.invokeStaticMethod(SourceFile:70)
at com.lily.sdk.Web.<init>(SourceFile:77)
......
I can not reproduce this crash through my android app, but the monitor system reports this kind of crash many times.
It is not clear whether the dex is broken or the system dalvik is not stable.
Does anyone has any experience on this kind of loadClass crash?
If the VM detects a serious problem, it will send diagnostics to the log, and abort. The VM in the version of Android you're using crashes itself by attempting to write to a read-only location (0xdeadd00d).
Looking at the stack trace, the last thing before dvmAbort() is dvmLinearAlloc(). Looking at a recent source file, the VM will abort in that function if it runs out of memory to allocate, or if it's unable to change the permissions on a page while in a special debug mode where pages are aggressively marked read-only. It's almost certainly the former. Looking at the logcat output would tell you for sure.
Assuming you're running out of memory, I'd guess you're running an old version of Android (<= gingerbread), where the "linear alloc" buffer was under-sized. This region of memory is used to hold class meta-data, such as tables of methods and fields, but not the data itself (which is why it can be marked read-only to help hunt for memory trashers). The only way to avoid the problem is to restructure the classes.
You can read more about the problem, and a solution deployed by Facebook engineers, in this blog post.

Getting an ANR and not sure what to do

I noticed my app will get an ANR and will literally hang there until I force the app to close. I'm not doing anything really on the main thread. I am using a 3rd party Video player SDK and I believe it might be something to do with that. I get this in the logcat:
Skipped 46 frames! The application may be doing too much work on its main thread.
I was also able to get the traces.txt from the phone when it goes into the ANR state. I'm not sure what I am supposed to be looking for but this is the main thread in the traces.txt. Does anyone see anything wrong in this?
"main" prio=5 tid=1 NATIVE
| group="main" sCount=1 dsCount=0 obj=0x4162ee40 self=0x4154f828
| sysTid=974 nice=-2 sched=0/0 cgrp=apps handle=1073942868
| state=S schedstat=( 0 0 0 ) utm=14100 stm=9716 core=0
#00 pc 00021814 /system/lib/libc.so (epoll_wait+12)
#01 pc 0001064f /system/lib/libutils.so (android::Looper::pollInner(int)+98)
#02 pc 00010879 /system/lib/libutils.so (android::Looper::pollOnce(int, int*, int*, void**)+92)
#03 pc 0006aa9d /system/lib/libandroid_runtime.so (android::NativeMessageQueue::pollOnce(_JNIEnv*, int)+22)
#04 pc 0002034c /system/lib/libdvm.so (dvmPlatformInvoke+112)
#05 pc 00050e6b /system/lib/libdvm.so (dvmCallJNIMethod(unsigned int const*, JValue*, Method const*, Thread*)+398)
#06 pc 000297e0 /system/lib/libdvm.so
#07 pc 00030ae8 /system/lib/libdvm.so (dvmMterpStd(Thread*)+76)
#08 pc 0002e180 /system/lib/libdvm.so (dvmInterpret(Thread*, Method const*, JValue*)+184)
#09 pc 00063751 /system/lib/libdvm.so (dvmInvokeMethod(Object*, Method const*, ArrayObject*, ArrayObject*, ClassObject*, bool)+392)
#10 pc 0006b713 /system/lib/libdvm.so
#11 pc 000297e0 /system/lib/libdvm.so
#12 pc 00030ae8 /system/lib/libdvm.so (dvmMterpStd(Thread*)+76)
#13 pc 0002e180 /system/lib/libdvm.so (dvmInterpret(Thread*, Method const*, JValue*)+184)
#14 pc 0006346d /system/lib/libdvm.so (dvmCallMethodV(Thread*, Method const*, Object*, bool, JValue*, std::__va_list)+336)
#15 pc 0004ca37 /system/lib/libdvm.so
#16 pc 0004d0f7 /system/lib/libandroid_runtime.so
#17 pc 0004de1b /system/lib/libandroid_runtime.so (android::AndroidRuntime::start(char const*, char const*)+354)
#18 pc 0000105b /system/bin/app_process
#19 pc 0000e41b /system/lib/libc.so (__libc_init+50)
#20 pc 00000d7c /system/bin/app_process
at android.os.MessageQueue.nativePollOnce(Native Method)
at android.os.MessageQueue.next(MessageQueue.java:138)
at android.os.Looper.loop(Looper.java:123)
at com.android.server.ServerThread.initAndLoop(SystemServer.java:1247)
at com.android.server.SystemServer.main(SystemServer.java:1412)
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:785)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
at dalvik.system.NativeStart.main(Native Method)

ResolveInfo.loadIcon causes ANR keyDispatchingTimedOut

One of my class retrieves the list of the activities installed on the device and their icons. That works perfectly well on numerous phones but one of my users using a Nexus 7 got an ANR :
DALVIK THREADS:
(mutexes: tll=0 tsl=0 tscl=0 ghl=0)
"main" prio=5 tid=1 NATIVE
| group="main" sCount=1 dsCount=0 obj=0x410a39a0 self=0x400d3010
| sysTid=15890 nice=0 sched=0/0 cgrp=apps handle=1075213276
| state=D schedstat=( 2274319000 316147000 1599 ) utm=146 stm=81 core=0
#00 pc 00016d78 /system/lib/libc.so (read+12)
#01 pc 00012b3f /system/lib/libutils.so (android::ZipFileRO::mapCentralDirectory()+114)
#02 pc 00012fe7 /system/lib/libutils.so (android::ZipFileRO::open(char const*)+126)
#03 pc 0001765d /system/lib/libandroidfw.so (android::AssetManager::SharedZip::SharedZip(android::String8 const&, long)+92)
#04 pc 00018129 /system/lib/libandroidfw.so (android::AssetManager::SharedZip::get(android::String8 const&)+232)
#05 pc 000181e9 /system/lib/libandroidfw.so (android::AssetManager::ZipSet::getZipResourceTableAsset(android::String8 const&)+32)
#06 pc 00018a6d /system/lib/libandroidfw.so (android::AssetManager::getResTable(bool) const+124)
#07 pc 0006451f /system/lib/libandroid_runtime.so
#08 pc 0001e290 /system/lib/libdvm.so (dvmPlatformInvoke+112)
#09 pc 0004d411 /system/lib/libdvm.so (dvmCallJNIMethod(unsigned int const*, JValue*, Method const*, Thread*)+396)
#10 pc 000276a0 /system/lib/libdvm.so
#11 pc 0002b57c /system/lib/libdvm.so (dvmInterpret(Thread*, Method const*, JValue*)+184)
#12 pc 0005ff07 /system/lib/libdvm.so (dvmInvokeMethod(Object*, Method const*, ArrayObject*, ArrayObject*, ClassObject*, bool)+374)
#13 pc 00066f95 /system/lib/libdvm.so
#14 pc 000276a0 /system/lib/libdvm.so
#15 pc 0002b57c /system/lib/libdvm.so (dvmInterpret(Thread*, Method const*, JValue*)+184)
#16 pc 0005ff07 /system/lib/libdvm.so (dvmInvokeMethod(Object*, Method const*, ArrayObject*, ArrayObject*, ClassObject*, bool)+374)
#17 pc 000677e1 /system/lib/libdvm.so
#18 pc 000276a0 /system/lib/libdvm.so
#19 pc 0002b57c /system/lib/libdvm.so (dvmInterpret(Thread*, Method const*, JValue*)+184)
#20 pc 0005fc31 /system/lib/libdvm.so (dvmCallMethodV(Thread*, Method const*, Object*, bool, JValue*, std::__va_list)+272)
#21 pc 000499fb /system/lib/libdvm.so
#22 pc 00046871 /system/lib/libandroid_runtime.so
#23 pc 00047533 /system/lib/libandroid_runtime.so (android::AndroidRuntime::start(char const*, char const*)+390)
#24 pc 00000db7 /system/bin/app_process
#25 pc 0001271f /system/lib/libc.so (__libc_init+38)
#26 pc 00000ae8 /system/bin/app_process
at android.content.res.AssetManager.getStringBlockCount(Native Method)
at android.content.res.AssetManager.makeStringBlocks(AssetManager.java:257)
at android.content.res.AssetManager.ensureStringBlocks(AssetManager.java:249)
at android.content.res.Resources.<init>(Resources.java:189)
at android.app.ActivityThread.getTopLevelResources(ActivityThread.java:1705)
at android.app.ActivityThread.getTopLevelResources(ActivityThread.java:1734)
at android.app.ApplicationPackageManager.getResourcesForApplication(ApplicationPackageManager.java:746)
at android.app.ApplicationPackageManager.getDrawable(ApplicationPackageManager.java:636)
at android.content.pm.PackageItemInfo.loadIcon(PackageItemInfo.java:140)
at android.content.pm.ComponentInfo.loadDefaultIcon(ComponentInfo.java:161)
at android.content.pm.PackageItemInfo.loadIcon(PackageItemInfo.java:145)
at android.content.pm.ResolveInfo.loadIcon(ResolveInfo.java:186)
It seems like the ANR is caused by ResolveInfo.loadIcon when I try to retrieve the activity icon...
Any idea why it could be caused on one device and not others ? Maybe one of his app is not correctly installed or something like this...
Thanks for your time.

Android monkey causes Application Not Responding in native library

I get this when running monkey -v -p package.name --throttle 1 --pct-syskeys 0 100000.
I suppose this is not my own code? It appears to be Android's drawing code.
Jellybean 4.1.1.
DALVIK THREADS:
(mutexes: tll=0 tsl=0 tscl=0 ghl=0)
"main" prio=5 tid=1 NATIVE
| group="main" sCount=1 dsCount=0 obj=0x41a5b568 self=0x41a4b9f8
| sysTid=20523 nice=0 sched=0/0 cgrp=apps handle=1074767408
| schedstat=( 0 0 0 ) utm=1189 stm=194 core=0
#00 pc 0000dc70 /system/lib/libc.so (__futex_syscall3+8)
#01 pc 00012bd4 /system/lib/libc.so (__pthread_cond_timedwait_relative+48)
#02 pc 00012c30 /system/lib/libc.so (__pthread_cond_timedwait+60)
#03 pc 00052bb5 /system/lib/libdvm.so (dvmChangeStatus(Thread*, ThreadStatus
)+68)
#04 pc 0004ce7b /system/lib/libdvm.so (dvmCallJNIMethod(unsigned int const*, JValue*, Method const*, Thread*)+398)
#05 pc 00027260 /system/lib/libdvm.so
#06 pc 0002bb38 /system/lib/libdvm.so (dvmInterpret(Thread*, Method const*, JValue*)+180)
#07 pc 0005f877 /system/lib/libdvm.so (dvmInvokeMethod(Object*, Method const*, ArrayObject*, ArrayObject*, ClassObject*, bool)+374)
#08 pc 00066d4d /system/lib/libdvm.so
#09 pc 00027260 /system/lib/libdvm.so
#10 pc 0002bb38 /system/lib/libdvm.so (dvmInterpret(Thread*, Method const*, JValue*)+180)
#13 pc 0004698d /system/lib/libandroid_runtime.so
#14 pc 0004746f /system/lib/libandroid_runtime.so (android::AndroidRuntime::start(char const*, char const*)+390)
#15 pc 00000dcf /system/bin/app_process
#16 pc 00016eab /system/lib/libc.so (__libc_init+38)
#17 pc 00000b34 /system/bin/app_process
at android.view.Surface.unlockCanvasAndPost(Native Method)
at android.view.ViewRootImpl.drawSoftware(ViewRootImpl.java:2267)
at android.view.ViewRootImpl.draw(ViewRootImpl.java:2151)
at android.view.ViewRootImpl.performDraw(ViewRootImpl.java:2019)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1830)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:998)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:4212)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:725)
at android.view.Choreographer.doCallbacks(Choreographer.java:555)
at android.view.Choreographer.doFrame(Choreographer.java:525)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:711)
at android.os.Handler.handleCallback(Handler.java:615)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4745)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
at dalvik.system.NativeStart.main(Native Method)

Categories

Resources