Backtrace on android native code - android

can anyone let me know what does this backtrace log indicates . i am spawning a thread in my code .but i am not able to undrstand what is wrong with that.
Thread creation code
pthread_create(&tid, &attr, (void*()(void))threadFunc, arg);
>I/DEBUG ( 6144): backtrace:
>I/DEBUG ( 6144): #00 pc 00014260 /system/lib/libc.so (dlmalloc+643)
>I/DEBUG ( 6144): #01 pc 00016f7f /system/lib/libc.so (malloc+10)
>I/DEBUG ( 6144): #02 pc 00061797 /system/lib/libdvm.so (dvmJdwpPostLocationEvent(JdwpState*, JdwpLocation const*, unsigned long long, int)+124)
I/DEBUG ( 6144): #03 pc 000438e1 /system/lib/libdvm.so (dvmDbgPostLocationEvent(Method const*, int, Object*, int)+76)
I/DEBUG ( 6144): #04 pc 0002b940 /system/lib/libdvm.so (dvmCheckBefore+504)
I/DEBUG ( 6144): #05 pc 0001e37c /system/lib/libdvm.so
I/DEBUG ( 6144): #06 pc 0002bba8 /system/lib/libdvm.so (dvmInterpret(Thread*, Method const*, JValue*)+180)
I/DEBUG ( 6144): #07 pc 0005f831 /system/lib/libdvm.so (dvmCallMethodV(Thread*, Method const*, Object*, bool, JValue*, std::__va_list)+272)
I/DEBUG ( 6144): #08 pc 0005f85b /system/lib/libdvm.so (dvmCallMethod(Thread*, Method const*, Object*, JValue*, ...)+20)
I/DEBUG ( 6144): #09 pc 00054413 /system/lib/libdvm.so
I/DEBUG ( 6144): #10 pc 00012e00 /system/lib/libc.so (__thread_entry+48)
I/DEBUG ( 6144): #11 pc 00012558 /system/lib/libc.so (pthread_create+172)
Thank You

Are you sure that this happens due pthread_create? Try to use ndk-stack command(from NDK) to find out the root cause(or android-ndk-stacktrace-analyzer):
adb logcat | ndk-stack -sym /path_to_your_project/obj/local/armeabi

Related

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.

How can I catch the invalid indirect refererce exception?

The following code will cause dvmAbort() when getting package name. But the context object was the global Application object, this reference should be valid.
I want to catch this exception or resolve this crash, Who can help me?
jclass ctx_class = env->GetObjectClass(context);
>>> Backtrace <<<
#00 pc 00022184 /system/lib/libc.so (tgkill+12)
#01 pc 000131d9 /system/lib/libc.so (pthread_kill+48)
#02 pc 000133ed /system/lib/libc.so (raise+10)
#03 pc 00012123 /system/lib/libc.so (?+0)
#04 pc 00021a38 /system/lib/libc.so (abort+4)
#05 pc 00048c9f /system/lib/libdvm.so (dvmAbort+78)
#06 pc 0004d607 /system/lib/libdvm.so (dvmDecodeIndirectRef(Thread*, _jobject*)+146)
#07 pc 0005018b /system/lib/libdvm.so (?+0)
#10 pc 000204cc /system/lib/libdvm.so (dvmPlatformInvoke+112)
#11 pc 00051157 /system/lib/libdvm.so (dvmCallJNIMethod(unsigned int const*, JValue*, Method const*, Thread*)+398)
#12 pc 00052b41 /system/lib/libdvm.so (dvmResolveNativeMethod(unsigned int const*, JValue*, Method const*, Thread*)+184)
#13 pc 00029960 /system/lib/libdvm.so (?+0)
#14 pc 00030dec /system/lib/libdvm.so (dvmMterpStd(Thread*)+76)
#15 pc 0002e484 /system/lib/libdvm.so (dvmInterpret(Thread*, Method const*, JValue*)+184)
#16 pc 000635b9 /system/lib/libdvm.so (dvmCallMethodV(Thread*, Method const*, Object*, bool, JValue*, std::__va_list)+336)
#17 pc 000635dd /system/lib/libdvm.so (dvmCallMethod(Thread*, Method const*, Object*, JValue*, ...)+20)
#18 pc 000582bb /system/lib/libdvm.so (?+0)
#19 pc 0000d2c8 /system/lib/libc.so (__thread_entry+72)
#20 pc 0000d460 /system/lib/libc.so (pthread_create+240)

Runtime.nativeLoad crashes when loading private library

SIGSEGV: SIGSEGV
#00 pc 4009a4c0 /system/bin/linker
#01 pc 4009b004 /system/bin/linker
#02 pc 4009b416 /system/bin/linker
#03 pc 4009b9ca /system/bin/linker
#04 pc 40099f42 /system/bin/linker
#05 pc 00051074 /system/lib/libdvm.so (_Z17dvmLoadNativeCodePKcP6ObjectPPc)
#06 pc 00068a18 /system/lib/libdvm.so
#07 pc 00027fa0 /system/lib/libdvm.so
#08 pc 0002f110 /system/lib/libdvm.so (_Z11dvmMterpStdP6Thread)
#09 pc 0002c774 /system/lib/libdvm.so (_Z12dvmInterpretP6ThreadPK6MethodP6JValue)
#10 pc 000619ea /system/lib/libdvm.so (_Z15dvmInvokeMethodP6ObjectPK6MethodP11ArrayObjectS5_P11ClassObjectb)
#11 pc 00069af6 /system/lib/libdvm.so
#12 pc 00027fa0 /system/lib/libdvm.so
#13 pc 0002f110 /system/lib/libdvm.so (_Z11dvmMterpStdP6Thread)
#14 pc 0002c774 /system/lib/libdvm.so (_Z12dvmInterpretP6ThreadPK6MethodP6JValue)
#15 pc 000619ea /system/lib/libdvm.so (_Z15dvmInvokeMethodP6ObjectPK6MethodP11ArrayObjectS5_P11ClassObjectb)
#16 pc 00069af6 /system/lib/libdvm.so
#17 pc 00027fa0 /system/lib/libdvm.so
#18 pc 0002f110 /system/lib/libdvm.so (_Z11dvmMterpStdP6Thread)
#19 pc 0002c774 /system/lib/libdvm.so (_Z12dvmInterpretP6ThreadPK6MethodP6JValue)
#20 pc 000619ea /system/lib/libdvm.so (_Z15dvmInvokeMethodP6ObjectPK6MethodP11ArrayObjectS5_P11ClassObjectb)
#21 pc 00069af6 /system/lib/libdvm.so
#22 pc 00027fa0 /system/lib/libdvm.so
#23 pc 0002f110 /system/lib/libdvm.so (_Z11dvmMterpStdP6Thread)
#24 pc 0002c774 /system/lib/libdvm.so (_Z12dvmInterpretP6ThreadPK6MethodP6JValue)
#25 pc 00061706 /system/lib/libdvm.so (_Z14dvmCallMethodVP6ThreadPK6MethodP6ObjectbP6JValueSt9__va_list)
#26 pc 0004ae1a /system/lib/libdvm.so
#27 pc 00050546 /system/lib/libandroid_runtime.so
#28 pc 000512d2 /system/lib/libandroid_runtime.so (_ZN7android14AndroidRuntime5startEPKcS2_)
#29 pc 4009605c /system/bin/app_process
#30 pc 0000e5e6 /system/lib/libc.so (__libc_init)
java:
java.lang.Runtime.nativeLoad(Native Method)
java.lang.Runtime.doLoad(Runtime.java:421)
java.lang.Runtime.load(Runtime.java:331)
java.lang.System.load(System.java:541)
....
It crashes at this line when trying to load a private library(.so):
System.load(so_path);
In addition, this code is invoked from a customized DexClassLoader, which loads a lot of private classes in associated with the native code in ".so".
However on most devices it is loaded regularly. And this issue is mostly found on devices with android api level 17, 16, 19.
Does any one have any experience or any idea about this issue? Thank you very much!

Cocos2d-x crash: signal 11 (SIGSEGV), code 1 (SEGV_MAPERR) - Unable to open unknown symbol file

I've tried lots of different answers found here at SO but none are directly related with this "unknown symbol file".
This is my crash dump:
********** Crash dump: **********
Build fingerprint: 'samsung/ks01ltexx/ks01lte:4.4.2/KOT49H/I9506XXUCNG3:user/release-keys'
pid: 22578, tid: 22596, name: Thread-1821 >>> com.gamedev.game <<<
signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 00000000
Stack frame I/DEBUG ( 341): #00 pc 00000000 <unknown>: Unable to open symbol file C:\proyects\game\proj.android\obj\local\armeabi/<unknown>. Error (22): Invalid argument
Stack frame I/DEBUG ( 341): #01 pc 0035f169 /data/app-lib/com.gamedev.game-8/libgame.so (Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeInit+100): Routine ft_lzw_file_init at ftlzw.c:?
Stack frame I/DEBUG ( 341): #02 pc 00020bcc /system/lib/libdvm.so (dvmPlatformInvoke+112)
Stack frame I/DEBUG ( 341): #03 pc 00051927 /system/lib/libdvm.so (dvmCallJNIMethod(unsigned int const*, JValue*, Method const*, Thread*)+398)
Stack frame I/DEBUG ( 341): #04 pc 000535d1 /system/lib/libdvm.so (dvmResolveNativeMethod(unsigned int const*, JValue*, Method const*, Thread*)+256)
Stack frame I/DEBUG ( 341): #05 pc 0002a060 /system/lib/libdvm.so
Stack frame I/DEBUG ( 341): #06 pc 00031510 /system/lib/libdvm.so (dvmMterpStd(Thread*)+76)
Stack frame I/DEBUG ( 341): #07 pc 0002eba8 /system/lib/libdvm.so (dvmInterpret(Thread*, Method const*, JValue*)+184)
Stack frame I/DEBUG ( 341): #08 pc 00063e75 /system/lib/libdvm.so (dvmCallMethodV(Thread*, Method const*, Object*, bool, JValue*, std::__va_list)+336)
Stack frame I/DEBUG ( 341): #09 pc 00063e99 /system/lib/libdvm.so (dvmCallMethod(Thread*, Method const*, Object*, JValue*, ...)+20)
Stack frame I/DEBUG ( 341): #10 pc 00058b6b /system/lib/libdvm.so
Stack frame I/DEBUG ( 341): #11 pc 0000d298 /system/lib/libc.so (__thread_entry+72)
Stack frame I/DEBUG ( 341): #12 pc 0000d430 /system/lib/libc.so (pthread_create+240)
Crash dump is completed
Here's the clue:
pc 00000000
The PC (program counter) register is zero, meaning that the program is trying to execute code at address zero. There's no code there, hence the failure to display the function name.
It's probably caused by trying to call a null function pointer, or perhaps a virtual function on an invalid or corrupted object.

Random crashes on COCOS2dx game android

Android NDK error while running application find this error in logcat.
Build fingerprint: 'i1017/i1017/i1017:4.1.1/JRO03H/20130601.100904:eng/release-keys'
pid: 1981, tid: 1990, name: FinalizerDaemon >>> com.verve.rummy <<<
signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr deadbaad
Stack frame #00 pc 00013778 /system/lib/libc.so
Stack frame #01 pc 00015b55 /system/lib/libc.so (dlfree+1628)
Stack frame #02 pc 00016d03 /system/lib/libc.so (free+10)
Stack frame #03 pc 0001de30 /system/lib/libdvm.so (dvmPlatformInvoke+112)
Stack frame #04 pc 0004d083 /system/lib/libdvm.so (dvmCallJNIMethod(unsigned int const*, JValue*, Method const*, Thread*)+394)
Stack frame #05 pc 00027260 /system/lib/libdvm.so
Stack frame #06 pc 0002bb68 /system/lib/libdvm.so (dvmInterpret(Thread*, Method const*, JValue*)+180)
Stack frame #07 pc 0005f7f1 /system/lib/libdvm.so (dvmCallMethodV(Thread*, Method const*, Object*, bool, JValue*, std::__va_list)+272)
Stack frame #08 pc 0005f81b /system/lib/libdvm.so (dvmCallMethod(Thread*, Method const*, Object*, JValue*, ...)+20)
Stack frame #09 pc 000543d3 /system/lib/libdvm.so
Stack frame #10 pc 00012b70 /system/lib/libc.so (__thread_entry+48)
Stack frame #11 pc 000122c8 /system/lib/libc.so (pthread_create+172)
I am getting this type of error in stack while running my android game.
Above i put my error log please help me for resolve this error.
Due to this my game crashes randomly.
I am using android NDK for build application
Sorry for my poor English.
Thanks in advance.

Categories

Resources