I wrote the application without NDK using and it can crash with random actions with the following error:
12-20 14:21:13.590 15718-15725 A/jazz: mediatek/protect/dalvik/vm/jazz/dexlang/dex_lang-inl.h:2415] void jazz::DexLang<BitcodeGenerator>::EmitInstruction(const jazz::AIR&) [with BitcodeGenerator = jazz::dixieland::BitcodeGenerator] unimplemented not
12-20 14:21:13.590 15718-15725 E/dalvikvm: VM aborting
12-20 14:21:13.590 15718-15725 A/libc: Fatal signal 11 (SIGSEGV) at 0xdeadd00d (code=1), thread 15725 (Compiler)
12-20 14:21:13.591 15718-15725 A/libc: Send stop signal to pid:15718 in debugger_signal_handler
I'm running the app on different emulators and devices, but on my device it constantly crashing.
Device:
PHONE_MODEL=JY-G4S
ANDROID_VERSION=4.2.2
BUILD=TIME=1402319802000
FINGERPRINT=JIAYU/S8/S8:4.2.2/JDQ39/1402319714:user/test-keys
HARDWARE=mt6592
USER=scm
HOST=vanzo68
DEVICE=S8
TAGS=test-keys
MODEL=JY-G4S
BOOTLOADER=unknown
VERSION.CODENAME=REL
VERSION.INCREMENTAL=eng.scm.1402319714
VERSION.RELEASE=4.2.2
VERSION.SDK_INT=17
VERSION.RESOURCES_SDK_INT=17
VERSION.SDK=17
CPU_ABI=armeabi-v7a
CPU_ABI2=armeabi
MANUFACTURER=JYT
BRAND=JIAYU
TYPE=user
PRODUCT=S8
Can I fix this error programmatically without flashing the device?
One thing I found is that using the next generation (D8) dex compiler might cause this issue. From my experience it seems like adding the property android.enableD8=true in your ./gradle/gradle.properties file might cause this issue on some pre lollipop devices.
After removing it again, it all started working on the troublesome devices where we was seeing the crash before.
It looks like the custom mediatek Dalvik JIT did not implement the dex "not" instruction. D8 generates this instruction and DX most likely did not. We will workaround the VM bug by never generating a "not" instruction in D8 when targeting Dalvik VMs.
We are pushing out the fix for Android Studio 3.1 so that this will not be a problem once Android Studio 3.1 goes stable.
Fix here: https://r8-review.googlesource.com/c/r8/+/16880
TL;DR Don't use D8 with Android Gradle Build Plugin 3.0.x.
I catch this JIT Compiler crash on Lenovo P70-A in our app. In our case the error was:
F/jazz (11964): mediatek/protect/dalvik/vm/jazz/dexlang/dex_lang-inl.h:2523] void jazz::DexLang<BitcodeGenerator>::EmitInstruction(const jazz::AIR&) [with BitcodeGenerator = jazz::dixieland::BitcodeGenerator] unimplemented not
E/dalvikvm(11964): VM aborting
F/libc (11964): Fatal signal 6 (SIGABRT) at 0x00002ebc (code=-6), thread 11970 (Compiler)
followed by crash dump:
I/DEBUG (12113): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
I/DEBUG (12113): Build fingerprint: 'Lenovo/P70-A/P70-A:4.4.4/KOT49H/P70-A_S142_161230_16G_ROW:user/release-keys'
I/DEBUG (12113): pid: 11964, tid: 11970, name: Compiler >>> com.myapp <<<
I/DEBUG (12113): signal 6 (SIGABRT), code -6 (SI_TKILL), fault addr --------
I/DEBUG (12113): r0 00000000 r1 00002ec2 r2 00000006 r3 00000000
I/DEBUG (12113): r4 00000006 r5 00000000 r6 00002ec2 r7 0000010c
I/DEBUG (12113): r8 85d1ea6d r9 40159bd4 sl 76dd58ac fp 8283af64
I/DEBUG (12113): ip fffd1aa8 sp 76dd5630 lr 40109431 pc 40117dec cpsr 000f0010
I/DEBUG (12113):
I/DEBUG (12113): backtrace:
I/DEBUG (12113): #00 pc 00025dec /system/lib/libc.so (tgkill+12)
I/DEBUG (12113): #01 pc 0001742d /system/lib/libc.so (pthread_kill+64)
I/DEBUG (12113): #02 pc 00017625 /system/lib/libc.so (raise+10)
I/DEBUG (12113): #03 pc 0001633b /system/lib/libc.so
I/DEBUG (12113): #04 pc 0002569c /system/lib/libc.so (abort+4)
I/DEBUG (12113): #05 pc 0008a8fd /system/lib/libdvm.so (dvmAbort+80)
I/DEBUG (12113): #06 pc 0015a1e9 /system/lib/libdvm.so (jazz::LogMessage::~LogMessage()+576)
I/DEBUG (12113): #07 pc 0014f49d /system/lib/libdvm.so (jazz::DexLang<jazz::dixieland::BitcodeGenerator>::EmitInstruction(jazz::AIR const&)+1016)
I/DEBUG (12113): #08 pc 0014f60b /system/lib/libdvm.so (jazz::dixieland::Frontend::Compile(unsigned int, jazz::AIRMethod const&)+346)
I/DEBUG (12113): #09 pc 00153925 /system/lib/libdvm.so (jazz::dixieland::SubCompiler::Compile(unsigned int, jazz::AIRMethod const&)+32)
I/DEBUG (12113): #10 pc 00154443 /system/lib/libdvm.so (jazz::Jazz::Compile(jazz::CompilationUnit&)+126)
I/DEBUG (12113): #11 pc 00140d4d /system/lib/libdvm.so (jazz::Compiler::JitMethod(Method const&, jazz::jex::CompiledRawCode const*&, jazz::jex::CompiledRawCode const*&)+164)
I/DEBUG (12113): #12 pc 0011873d /system/lib/libdvm.so (jazzDoJITCompile(JitJazzMethodDescription const&, JitTranslationInfo&)+128)
I/DEBUG (12113): #13 pc 000f204f /system/lib/libdvm.so (dvmCompilerDoWork(CompilerWorkOrder*)+50)
I/DEBUG (12113): #14 pc 000d9f77 /system/lib/libdvm.so
I/DEBUG (12113): #15 pc 000a0485 /system/lib/libdvm.so
I/DEBUG (12113): #16 pc 0000d838 /system/lib/libc.so (__thread_entry+72)
I/DEBUG (12113):
I/DEBUG (12113): stack:
...
As mentioned in other answers it was caused by D8 implementation which is using not instruction in Dalvik binary code, but JIT Compiler on this device not support this instruction. Solution is to disable D8 in compilation by removing android.enableD8=true from gradle.properties for AGP 3.0.x. Stable AGP 3.1 will contain fix for this.
Edit: Probably this happen on the devices with Mediatek SOC where is running KitKat.
Related
I am debugging a huge NDK project in Android Studio, the app crashes at semingly random times with message similar to
A/libc: Fatal Signal 11 (SIGSEGV), code 1, fault addr 0x30 in fid 22993 (Thread-99505)
The numbers are different at times but the error is similar, and sometimes the Run tab in Android studio doesn't even show any error at all and the program just crashes with the message Application terminated
By looking around I have found that android should generate some kind of crash log similar to ones shown here
https://source.android.com/devices/tech/debug/native-crash
But I do not understand how to get them, or whether there is some setting in Android Studio that allows me to view them
How do I get crash reports like these from Android Studio?
Android Studio version 3.0.1 in Apple macbook
Instead of the Run tab, look at the Logcat. Don't set the filter to your app only. There is a good chance that you will see a stack trace, like
I/DEBUG ( 31): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
I/DEBUG ( 31): Build fingerprint: 'generic/google_sdk/generic/:2.2/FRF91/43546:eng/test-keys'
I/DEBUG ( 31): pid: 351, tid: 351 >>> /data/local/ndk-tests/crasher <<<
I/DEBUG ( 31): signal 11 (SIGSEGV), fault addr 0d9f00d8
I/DEBUG ( 31): r0 0000af88 r1 0000a008 r2 baadf00d r3 0d9f00d8
I/DEBUG ( 31): r4 00000004 r5 0000a008 r6 0000af88 r7 00013c44
I/DEBUG ( 31): r8 00000000 r9 00000000 10 00000000 fp 00000000
I/DEBUG ( 31): ip 0000959c sp be956cc8 lr 00008403 pc 0000841e cpsr 60000030
I/DEBUG ( 31): #00 pc 0000841e /data/local/ndk-tests/crasher
I/DEBUG ( 31): #01 pc 000083fe /data/local/ndk-tests/crasher
I/DEBUG ( 31): #02 pc 000083f6 /data/local/ndk-tests/crasher
I/DEBUG ( 31): #03 pc 000191ac /system/lib/libc.so
I/DEBUG ( 31): #04 pc 000083ea /data/local/ndk-tests/crasher
I/DEBUG ( 31): #05 pc 00008458 /data/local/ndk-tests/crasher
I/DEBUG ( 31): #06 pc 0000d362 /system/lib/libc.so
I/DEBUG ( 31):
Android NDK includes a command ndk-stack that can help match the addresses with actual source files of your code, which is based on the addr2line utility in NDK toolchain.
Further instructions for understanding the stack trace: https://developer.android.com/studio/debug/stacktraces
From comments:
You may find the 'unstripped' libraries under app/build/intermediates/transforms/mergeJniLibs
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.
Our company have an Android app that's been out for a few months now, where very few crashes have been reported.
But with Lollipop upgrades being rolled out to our customers devices, we got reports about intermittent Segmentation fault (SIGSEGV) crashes. And the crashes only occur on Android 5.0 devices - like upgraded Samsung Galaxy 5, Sony Xperia Z3, new HTC devices (unsure of model name) and a few other. All Android 4+ devices runs our app without problems, but all tested Android 5 devices so far get these crashes.
We have been able to reproduce them, in the sense that we on our own devices get these crashes. But we have so far been able to locate the source of the crashes, or find a pattern in what causes them.
This one of the reported crash dumps:
*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
Build fingerprint: 'samsung/klteactivexx/klteactive:5.0/LRX21T/xxxxxx:user/release-keys'
Revision: '8'
ABI: 'arm'
pid: 8779, tid: 10227, name: hwuiTask2 >>> com.ourcompany.ourapp <<<
signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0xbd04a008
r0 9d04a00c r1 b6f6b87c r2 9d04a000 r3 ffffffe2
r4 00000001 r5 07ffffff r6 00000002 r7 b6f6b894
r8 00000002 r9 fffffffc sl b6f6b87c fp 0000001f
ip 00000004 sp 9ee71a8c lr b6f37f4d pc b6f36a52 cpsr 00010030
backtrace:
#00 pc 0003ca52 /system/lib/libc.so (arena_run_reg_alloc+101)
#01 pc 0003df49 /system/lib/libc.so (je_arena_tcache_fill_small+96)
#02 pc 0004bad7 /system/lib/libc.so (je_tcache_alloc_small_hard+14)
#03 pc 000476af /system/lib/libc.so (je_malloc+302)
#04 pc 0000fa5f /system/lib/libc.so (malloc+10)
#05 pc 00000b09 /system/lib/libstdc++.so (operator new(unsigned int)+4)
#06 pc 000e2ecf /system/lib/libskia.so (SkPathRef::Editor::Editor(SkAutoTUnref<SkPathRef>*, int, int)+32)
#07 pc 000df1c1 /system/lib/libskia.so (SkPath::incReserve(unsigned int)+12)
#08 pc 000e0631 /system/lib/libskia.so (SkPath::addRRect(SkRRect const&, SkPath::Direction)+120)
#09 pc 000e0745 /system/lib/libskia.so (SkPath::addRoundRect(SkRect const&, float, float, SkPath::Direction)+76)
#10 pc 0003e6fd /system/lib/libhwui.so
#11 pc 0003e2ad /system/lib/libhwui.so
#12 pc 000314b3 /system/lib/libhwui.so
#13 pc 0001512b /system/lib/libhwui.so
#14 pc 0000ef11 /system/lib/libutils.so (android::Thread::_threadLoop(void*)+112)
#15 pc 000602f5 /system/lib/libandroid_runtime.so (android::AndroidRuntime::javaThreadShell(void*)+72)
#16 pc 0000ea81 /system/lib/libutils.so
#17 pc 000137bb /system/lib/libc.so (__pthread_start(void*)+30)
#18 pc 0001189b /system/lib/libc.so (__start_thread+6)
We have no native code in the app written by ourself, and the only libs we're using besides the Android libs are GSon 2.3.1, Ormlite 4.48 and Spring 1.0.0.
I'm a bit unsure how to proceed with these errors, so any help would be welcome. I have seen suggestions to use NDK Stack Tool to translate the crash dump to something more readable, but with no pre-existing knowledge about NDK, I have so far not been able to get it to work in my dev enviroment (Windows7, Eclipse Kepler.
Anyone who has any similiar experiences when Android 5.0 upgrades started to roll out to customers, or have any ideas on how or where I should continue to look for the cause?
I guess NDK Stack Tool is my best hope, but I have so far been unable to find a good tutorial that get's me anywhere with it.
New one to me for errors signal 4 SIGILL. When I take a look at the tombstone file and type int he address I get ?? i.e.
Here is someof the tombstone:
*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
Build fingerprint: 'generic/sdk/generic/:2.2/FRF91/43546:eng/test-keys'
pid: 2083, tid: 2089 >>> com.activities <<<
signal 4 (SIGILL), fault addr 00016b10
r0 00000006 r1 8086caa4 r2 8086fbcf r3 0006b60b
r4 80887fc4 r5 0006b60b r6 00000000 r7 00000000
r8 80813b00 r9 4e23a038 10 00000019 fp 0011d230
ip 808880f8 sp 47bcbca8 lr 8083a8d1 pc 00016b10 cpsr 20000010
#00 pc 00016b10 [heap]
#01 pc 0003a8ce /system/lib/libdvm.so
#02 pc 0003d02c /system/lib/libdvm.so
#03 pc 0001890c /system/lib/libdvm.so
#04 pc 0001e8c4 /system/lib/libdvm.so
#05 pc 0001d790 /system/lib/libdvm.so
#06 pc 0005408e /system/lib/libdvm.so
#07 pc 0005bde2 /system/lib/libdvm.so
#08 pc 00018714 /system/lib/libdvm.so
#09 pc 0001e8c4 /system/lib/libdvm.so
#10 pc 0001d790 /system/lib/libdvm.so
#11 pc 00053eec /system/lib/libdvm.so
#12 pc 00054102 /system/lib/libdvm.so
#13 pc 0004825a /system/lib/libdvm.so
#14 pc 0001103c /system/lib/libc.so
#15 pc 00010b20 /system/lib/libc.so
I go my android-ndk-r7\toolchains\arm-linux-androideabi-4.4.3\prebuilt\windows\bin directory using command window, type in this command and get no function at all.
arm-linux-androideabi--addr2line.exe -C -f -e libdvm.so 0003a8ce
and it returns
??
??:0
I seem to remember this working before...and yes I have the libdvm.so in the same working directory.
Well apparently this occurs only when I test it on the 2.2 emulator. On a myTouch 3G phone the code never crashes. Must be a pointer memory issue or not enough RAM allocated for simulator.