my Android vector-drawing application is uncommonly crashing somewhere in native code. I cannot catch the crash with Java try-catch block, I can see it only in the Google Play Developer console in the "Crashes and ANR's" section.
Here is the trace from the console:
Build fingerprint: 'samsung/kltexx/klte:5.0/LRX21T/G900FXXU1BOJ1:user/release-keys'
Revision: '14'
ABI: 'arm'
pid: 31153, tid: 31153, name: ... >>> ... <<<
signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x65eb3cf4
r0 65eb3cf4 r1 a75f2764 r2 7fffffff r3 be8c15ec
r4 af56a838 r5 7fffffff r6 be8c1570 r7 b4efac6c
r8 b4efac6c r9 be8c15c0 sl 00000000 fp be8c1590
ip b4efac6c sp be8c1528 lr a75f2760 pc b5a60ae6 cpsr a0000030
backtrace:
#00 pc 000ecae6 /system/lib/libskia.so (SkRegion::Oper(SkRegion const&, SkRegion const&, SkRegion::Op, SkRegion*)+861)
#01 pc 000ecc67 /system/lib/libskia.so (SkRegion::op(SkRegion const&, SkIRect const&, SkRegion::Op)+28)
#02 pc 000969df /system/lib/libandroid_runtime.so
#03 pc 00ba8897 /system/framework/arm/boot.oat
Can anyone help me? How can I locate the problematic place in my code?
Thank you!
The reason of the crash was my own fault:
I'm using the android.graphics.Region class in my application. I'm calling the Region.op() method and a problem was that I was calling the method from two different threads.
These operations aren't thread-safe, so that was the reason of the crashes.
Related
My game facing this crash sometime in particular Samsung Device, and i dint know what to do for this type of problem. I have already import app compatibility v7 in my project.
Build fingerprint: 'samsung/grandppltedtvvj/grandppltedtv:6.0.1/MMB29T/G532MTVJU1AQB1:user/release-keys'
Revision: '5'
ABI: 'arm'
pid: 22325, tid: 22341, name: GLThread 42320 >>> com.abc.candy <<<
signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x4
r0 00000000 r1 00000000 r2 00000000 r3 00000000
r4 00000001 r5 00000001 r6 00000001 r7 00000001
r8 00000001 r9 b31a1f00 sl 00000000 fp b2f402bc
ip b2f3fec4 sp b2f402a8 lr 9edd50d4 pc 9ee82900 cpsr 200f0010
backtrace:
#00 pc 0062e900 /data/app/com.abc.candy-1/lib/arm/libcocos2dcpp.so (_ZN7cocos2d3Ref6retainEv+20)
#01 pc 005810d0 /data/app/com.abc.candy2-1/lib/arm/libcocos2dcpp.so (_ZN7cocos2d6Sprite14setSpriteFrameEPNS_11SpriteFrameE+92)
#02 pc 00580fc4 /data/app/com.abc.candy-1/lib/arm/libcocos2dcpp.so (_ZN7cocos2d6Sprite14setSpriteFrameERKSs+616)
#03 pc 0041c23c /data/app/com.abc.candy-1/lib/arm/libcocos2dcpp.so (_ZN9GameScene15generateSpecialEP5CandySsii+844)
#04 pc 00425e18 /data/app/com.abc.candy-1/lib/arm/libcocos2dcpp.so
#05 pc 00432cfc /data/app/com.abc.candy-1/lib/arm/libcocos2dcpp.so
#06 pc 004dba4c /data/app/com.abc.candy-1/lib/arm/libcocos2dcpp.so (_ZNKSt8functionIFvvEEclEv+60)
#07 pc 004dabec /data/app/com.abc.candy-1/lib/arm/libcocos2dcpp.so (_ZN7cocos2d8CallFunc7executeEv+204)
#08 pc 004dab14 /data/app/com.abc.candy-1/lib/arm/libcocos2dcpp.so (_ZN7cocos2d8CallFunc6updateEf+40)
#09 pc 004df2bc /data/app/com.abc.candy-1/lib/arm/libcocos2dcpp.so (_ZN7cocos2d8Sequence6updateEf+1140)
#10 pc 004de3a8 /data/app/com.abc.candy-1/lib/arm/libcocos2dcpp.so (_ZN7cocos2d14ActionInterval4stepEf+584)
#11 pc 0073c4f4 /data/app/com.abc.candy-1/lib/arm/libcocos2dcpp.so (_ZN7cocos2d13ActionManager6updateEf+244)
#12 pc 00603000 /data/app/com.abc.candy-1/lib/arm/libcocos2dcpp.so (_ZZN7cocos2d9Scheduler14scheduleUpdateINS_13ActionManagerEEEvPT_ibENKUlfE_clEf+36)
#13 pc 00604b9c /data/app/com.abc.candy-1/lib/arm/libcocos2dcpp.so (_ZNSt17_Function_handlerIFvfEZN7cocos2d9Scheduler14scheduleUpdateINS1_13ActionManagerEEEvPT_ibEUlfE_E9_M_invokeERKSt9_Any_dataf+60)
#14 pc 004ea360 /data/app/com.abc.candy-1/lib/arm/libcocos2dcpp.so (_ZNKSt8functionIFvfEEclEf+88)
#15 pc 0063aeac /data/app/com.abc.candy-1/lib/arm/libcocos2dcpp.so (_ZN7cocos2d9Scheduler6updateEf+172)
#16 pc 005fe90c /data/app/com.abc.candy-1/lib/arm/libcocos2dcpp.so (_ZN7cocos2d8Director9drawSceneEv+160)
#17 pc 00602d74 /data/app/com.abc.candy-1/lib/arm/libcocos2dcpp.so (_ZN7cocos2d19DisplayLinkDirector8mainLoopEv+136)
#18 pc 004638a0 /data/app/com.abc.candy-1/lib/arm/libcocos2dcpp.so (Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeRender+40)
#19 pc 006da6a5 /data/app/com.abc.candy-1/oat/arm/base.odex (offset 0x512000)
Build fingerprint: 'samsung/j23gdd/j23g:5.1.1/LMY48B/J200HXXU0APK1:user/release-keys'
Revision: '2'
ABI: 'arm'
pid: 22292, tid: 22310, name: GLThread 3374 >>> com.abc.candy <<<
signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x20
r0 9f21dc00 r1 00000078 r2 00000078 r3 00000000
r4 a3396b5c r5 a2dcbd5c r6 9f21dc00 r7 9f280184
r8 010f03ce r9 b4428400 sl 00000000 fp a264e854
ip 9f21dc00 sp a264e800 lr a2c68d48 pc a2c68b4c cpsr 800f0010
All this crash comes in Samsung device not in other device.
You can check the exact line number where crash occurs by using following :-
When you get errors like this on the LogCat, they are saved on $PROJECT_PATH/obj/local/armeabi where $PROJECT_PATH is the path to your cocos2d-x android project. To symbolicate the messages to something understandable, you can use the ndk-stack tool.
Open up the Terminal (or Cygwin, not sure though) and type in
cd $ANDROID_NDK
adb logcat | ./ndk-stack -sym $PROJECT_PATH/obj/local/armeabi
where:
$ANDROID_NDK is the path to your android NDK
$PROJECT_PATH is the path to your cocos2d-x android project
I have reports from several users that my app is crashing after about 5 minutes of intensive use. I have received crash logs on Google Play and an example is attached below. The message seems to be:
JNI ERROR (app bug): weak global reference table overflow (max=51200)'
I'm not familiar with the JNI and would appreciate so any advice/explanations/suggestions on how to figure this out. The likely cause is something in my code is not getting cleaned up, but what?
The devices that this issue has been reported on are Nexus 5.x, Galaxy S7 and Nexus 6.
The relevant code can be found in my open source project: https://gitlab.com/hodgskin-callan/Invention. However, I don't have the minimum code to reproduce the issue and it does not reproduce on my Nexus 9. I suspect this issue is not affecting the majority of the Android users.
*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
Build fingerprint: 'google/bullhead/bullhead:7.1.1/N4F26T/3687331:user/release-keys'
Revision: 'rev_1.0'
ABI: 'arm'
pid: 10404, tid: 10404, name: .x10host.pathos >>> com.x10host.pathos <<<
signal 6 (SIGABRT), code -6 (SI_TKILL), fault addr --------
Abort message: 'art/runtime/indirect_reference_table.cc:132] JNI ERROR (app bug): weak global reference table overflow (max=51200)'
r0 00000000 r1 000028a4 r2 00000006 r3 00000008
r4 f300558c r5 00000006 r6 f3005534 r7 0000010c
r8 00000000 r9 0000000a sl 00001785 fp f0385400
ip 0000000b sp ffde7b50 lr f1a065e7 pc f1a08e44 cpsr 200f0010
backtrace:
#00 pc 00049e44 /system/lib/libc.so (tgkill+12)
#01 pc 000475e3 /system/lib/libc.so (pthread_kill+34)
#02 pc 0001d8a5 /system/lib/libc.so (raise+10)
#03 pc 000193f1 /system/lib/libc.so (__libc_android_abort+34)
#04 pc 00017034 /system/lib/libc.so (abort+4)
#05 pc 0031a5f1 /system/lib/libart.so (_ZN3art7Runtime5AbortEPKc+328)
#06 pc 000b5205 /system/lib/libart.so (_ZN3art10LogMessageD2Ev+1132)
#07 pc 001bc42b /system/lib/libart.so (_ZN3art22IndirectReferenceTable3AddEjPNS_6mirror6ObjectE+194)
#08 pc 0023a097 /system/lib/libart.so (_ZN3art9JavaVMExt16AddWeakGlobalRefEPNS_6ThreadEPNS_6mirror6ObjectE+46)
#09 pc 0027f483 /system/lib/libart.so (_ZN3art3JNI16NewWeakGlobalRefEP7_JNIEnvP8_jobject+418)
#10 pc 0000de14 /data/app/com.x10host.pathos-2/lib/arm/libmonodroid.soapp/com.x10host.pathos-2/lib/arm/libmonodroid.so
There's a long, but very useful piece of documentation on this subject here:
https://developer.xamarin.com/guides/android/troubleshooting/troubleshooting/#Global_Reference_Messages
For a first pass through, you should attempt to enable the system property through a .txt file that has it's Build Action set to $(AndroidEnvironment):
i.e. debug.mono.log gref
https://developer.xamarin.com/guides/android/advanced_topics/environment/#Xamarin.Android_System_Properties
You would then obtain an adb logcat from the device which will include this logging.
However if that doesn't work to your favor:
You should be able to query directly via:
Java.Interop.JniRuntime.CurrentRuntime.GlobalReferenceCount
Java.Interop.JniRuntime.CurrentRuntime.WeakGlobalReferenceCount
The local references are also tracked in Java.Interop.JniEnvironment.LocalReferenceCount which is a thread-local value.
I released an application and I get these native crashes especially from Galaxy J2(90% of crashes). Users say when App starts it is an immidiate crash. So far I got 25 crashes and I cant even find what is wrong to solve. I am unable to debug on Galaxy J2 but every device that I run the application works with no problem. Here is crash report.
Revision: '4'
ABI: 'arm'
pid: 4110, tid: 4110, name: sth.someappname >>> com.sth.someappname <<<
signal 6 (SIGABRT), code -6 (SI_TKILL), fault addr --------
Abort message: '* Assertion at /Users/builder/data/lanes/3511/b5fafb24/source/mono/mono/mini/method-to-ir.c:12777, condition `mono_arch_opcode_supported (OP_ATOMIC_STORE_I4)' not met
'
r0 00000000 r1 0000100e r2 00000006 r3 00000000
r4 b6f14e38 r5 00000006 r6 00000002 r7 0000010c
r8 b4542cac r9 00000000 sl b47709b8 fp bef19930
ip 0000100e sp bef198d8 lr b6d67e79 pc b6d8bb5c cpsr 600e0010
backtrace:
#00 pc 0003bb5c /system/lib/libc.so (tgkill+12)
#01 pc 00017e75 /system/lib/libc.so (pthread_kill+52)
#02 pc 00018a8b /system/lib/libc.so (raise+10)
#03 pc 00015325 /system/lib/libc.so (__libc_android_abort+36)
#04 pc 00012fb0 /system/lib/libc.so (abort+4)
#05 pc 00291cdc /data/app/com.sth.someappname-1/lib/arm/libmonosgen-2.0.so
Any idea?
I got rid of this issue by removing thread.sleep() function from splash screen. Then I decided to remove all of them from project.
Environment: Cocos2d-x 3.9, Android Studio priview 2.0, ndk r10e (64-bit), win10(64bit).
Cocos-console seems to use NDK to compile all my cpp component into one libcocos2dcpp.so file. I managed to get my app compiled. It ran well on win32, but crashed on Android.
I/DEBUG: Build fingerprint: 'samsung/h3gzc/hlte:5.0/LRX21V/N9006ZCUGOH2:user/release-keys'
I/DEBUG: Revision: '8'
I/DEBUG: ABI: 'arm'
I/DEBUG: pid: 2561, tid: 2561, name: Zzzen.YourWorld >>> com.github.Zzzen.YourWorld <<<
I/DEBUG: signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x0
I/DEBUG: r0 b4f512b0 r1 1fffffff r2 2e7e0d8d r3 b4f512b0
I/DEBUG: r4 00000043 r5 b4f18228 r6 a20f99e4 r7 00000000
I/DEBUG: r8 b4f07800 r9 b4efac64 sl bef10b58 fp bef10984
I/DEBUG: ip a275abd0 sp bef10978 lr a20f9a10 pc 00000000 cpsr 600f0010
I/DEBUG: #00 pc 00000000 <unknown>
I/DEBUG: #01 pc 00352a0c /data/app/com.github.Zzzen.YourWorld-1/lib/arm/libcocos2dcpp.so (JNI_OnLoad+40)
I/DEBUG: #02 pc 001d5357 /system/lib/libart.so (art::JavaVMExt::LoadNativeLibrary(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, art::Handle<art::mirror::ClassLoader>, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >*)+1478)
I/DEBUG: #03 pc 001fd061 /system/lib/libart.so (art::Runtime_nativeLoad(_JNIEnv*, _jclass*, _jstring*, _jobject*, _jstring*)+548)
I/DEBUG: #04 pc 00019811 /system/framework/arm/boot.oat
So I used addr2line to see what's at 00352a0c. However, It just showed JNI_OnLoad. Should I add assertions after creating a sprite in case Sprite::create may return nullptr?
I often use Cocos2d-x 's log function to find out where the app crash.
(e.g. log("sprite began... x = %f, y = %f", locationInNode.x, locationInNode.y);)
You can filter the log messages by 'cocos2d' in Android studio to see all logs about your cocos2d-x app.
My app crashes upon startup whenever I test it on phones that have the Snapdragon 410 chipset. I have dozens of reports of this happening to end-users and all of them so far come have from devices that use the Snapdragon 410 chipset. I went out and purchased two Snapdragon 410 phones (Moto E, LG Leon) and both of them exhibit the crash. So far, testing on other devices sees no crash occur.
Here is the log:
Fatal signal 6 (SIGABRT), code -6 in tid 9447 (com.myapp)
Build fingerprint: 'lge/c50_tmo_us/c50:5.1.1/LMY47V/151671737ee07:user/release-keys'
Revision: '8'
ABI: 'arm'
pid: 9447, tid: 9447, name: com.myapp >>> com.myapp <<<
signal 6 (SIGABRT), code -6 (SI_TKILL), fault addr --------
r0 00000000 r1 000024e7 r2 00000006 r3 00000000
AM write failure (32 / Broken pipe)
r4 b6f70e38 r5 00000006 r6 0000000b r7 0000010c
r8 a10724a1 r9 becdf520 sl 00100c12 fp 00100c0e
ip 000024e7 sp becdf498 lr b6df804d pc b6e1f648 cpsr 600d0010
backtrace:
#00 pc 0003b648 /system/lib/libc.so (tgkill+12)
#01 pc 00014049 /system/lib/libc.so (pthread_kill+52)
#02 pc 00014c67 /system/lib/libc.so (raise+10)
#03 pc 000114e1 /system/lib/libc.so (__libc_android_abort+36)
#04 pc 0000f72c /system/lib/libc.so (abort+4)
#05 pc 00049fbd /system/lib/libc++.so
#06 pc 000491b5 /system/lib/libc++.so (__clear_cache+32)
#07 pc 00002a21 /data/data/bn.ereader/files/libcrashreport.so (deleted)
Tombstone written to: /data/tombstones/tombstone_00
I have isolated the crash trigger to an external library jar which I bundle with my app; when I remove the external jar (and my code that invokes it by calling externalLibrary.init()), the crash does not occur. Since I do not have the source code for the external jar, I do not yet know the root cause of the problem.
The framework's crash handler plops a tombstone, but my device is not rooted and I haven't been able to recover the tombstone yet. I might try rooting the device to make the tombstone pluckable.