The code for my Dart/Flutter application communicates with my native dynamic .so library, which is very performance intensive. The library is written in Rust. It works fine with targets aarch64-linux-android and x86_64-linux-android. When I run with target armv7-linux-androideabi the following line (Dart Code) crashes.
final dylib = DynamicLibrary.open("libmyimportantlib.so");
Here is the error message: Note that no code in the library is run, the crash occurs as soon as it is loaded (or tries to load).
F/libc ( 7651): Fatal signal 11 (SIGSEGV), code 1, fault addr 0x0 in tid 7742 (DartWorker)
Can anyone tell me why it works on all other targets but not armv7-linux-androideabi?
I fixed the problem by downgrading the NDK version from 21 to 19. Apparently there is a problem with libc in the armv7-linux-androideabi target for version 20 and up.
Related
I have been stuck with Fatal Signal errors since using Visual Studio 2019 or 2022 to compile my Xamarin Android Project for more than 3 weeks.
I have used ndk-stack and other tools to see any meaningful stack trace I have failed and our project is not going ahead because of this.
Please note that the same exact code base works perfectly stable if I produce an APK using visual Studio 2017.
Visual Studio 2019 uses Xamarin.Andriod.SDK 12.0.0.3
Visual Studio 2017 uses Xamarin.Android.SDK 9.7.1.0
I have attempted to upgrade to Android 12 but our project is Huge and require significant amount of work. It does not seem to be an option at this point.
The reason I want to use 2019 or 2022 is because of google play store and producing app bundle instead of APK. Visual Studio 2017 does not have app bundle option.
My projects target Android 9 and I am also using PortSip Libraries. I have done extensive googling. I have not found any solid evidence if there is a problem with Xamarin Android SKD in 2019 or a problem with my Samsung Device Tab S6. The only answer I found here is:
Why application is dying randomly?
If this the case why an APK produced by 2017 does not have any segmentation faults or any race conditions.
I have handlers in c# to catch any error but non of them catches these. My app uses google MAPs and we are drawing many layers and updates on the MAP.
My app also receives many signalr updates and makes calls to WCF services.
Examples of errors:
03-09 19:54:53.811 9984 12254 F libc : Fatal signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x40000000080 in tid 12254 (Thread Pool Wor), pid 9984 (------)
03-09 19:54:53.836 12404 12404 E chromium: [0309/195453.835730:ERROR:scoped_ptrace_attach.cc(27)] ptrace: Operation not permitted (1)
03-11 00:35:05.469 27236 27236 F DEBUG : signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x7c13725238
We had a very similar problem with PortSip (null reference exception that was caused by the Garbage Collection thread in PortSip). We found that the problem was in the way a key class PortSip constructor contained mutual references with other classes. When those classes were disposed a null reference exception occurred on the garbage collection thread.
You reported that "I have handlers in C# to catch any error but none of them catches these". We found that to be the case as well. It turned out that since the crash was happening on the CG thread inside the PortSip library - adding error handling in C# had no effect.
If your crashes are also experiencing these symptoms - I will dig into the code and document our fix.
I'm developing a voip app using PJSIP 2.8. Recently I've moved to aab package approach and providing support for 64 bit device so when my device run on 64 bit device "arm64-v8a" it crashed during the call with this error
libc : Fatal signal 11 (SIGSEGV), code 1, fault addr 0x7129621350 in tid 29032 (AudioRecord)
It worked fine if i prepare a apk and remove ndk filter from gradle.
Any help is much appreciated.
I just run into s problem.When I changed my gradle version to 2.1.0(old version is 1.5.0),my code went wrong.And it's wierd there is no logcat,so I just don't know how to find the problem and the wrong part code. I have tryed to add android:allowClearUserData="true" in my AndroidManifest .it turns out not working. when I change my gradle version to the old one,it goes well.I am a new coder,and I use Retrofit to do the network job.plz just help me.Oh and I open the OpenGL stack in the logcat,It will call glGetError() then it goes crush.
From your description, I have no idea. If only upgrading AS, it should be not crashed, but for possible updated SDK or Build tool Env. If you back to 1.5, even no crash when using same platform sdk, support library sdk?
After upgrading 2.1.0, When was crash happened? launching app, or opening some Activity? If later, you should limit your code to some extension, then searching from Google.
From crash info, it should be related with JNI. if you use JNI,your app has a library path in the app installed directory to list all support ABI .so. You could found the differ btw woking machine and abnormal one. From this stackOverflow, you can try too.
Being new to Android NDK Caffe, I would like to use built version in my Android project. I tried to run this built sample demo, but while running, it showed the following:
03-26 14:46:35.697 2800-3042/com.sh1r0.caffe_android_demo A/libc﹕ Fatal signal 11 (SIGSEGV) at 0x00000000 (code=1), thread 3042 (AsyncTask #1)
(the app crashed)
I can see that the sigsev signal is thrown through android AsyncTask.
The problem could come from this function.
caffeMobile.predictImage(strings[0])[0]; //line 160 of MainActivity
This signal comes from JNI and it is very difficult to know where is the problem unless you can debug natively (through ndk) the app. The caffe-sample is not configured to debug on native method.
Try this issues to manage the error:
Ensure that your image path in this string[0] arrays are not empty. and exists.
Ensure that the other caffeMobile functions are able to exec without
problems, for example:
caffeMobile = new CaffeMobile();
caffeMobile.setNumThreads(4);
caffeMobile.loadModel("/sdcard/caffe_mobile/bvlc_reference_caffenet/deploy.prototxt", "/sdcard/caffe_mobile/bvlc_reference_caffenet/bvlc_reference_caffenet.caffemodel");
If you are able to execute the other functions, probably your image path is not correct, check.
If you are not able to execute loadModel or setNumThreads function, probably the apk is not loading libjni.so library correctly , or the jni bridge is not able to locate jni functions.
I am working on a app, where I will use android NDK & JNI.
Whenever I run my app on any android 4.0 or higher version... my app will crash and gives the following error...
A/libc(18556): Fatal signal 11 (SIGSEGV) at 0xdeadbaad (code=1)
D/libEGL(18606): loaded /system/lib/egl/libGLES_android.so
D/libEGL(18606): loaded /system/lib/egl/libEGL_adreno200.so
D/libEGL(18606): loaded /system/lib/egl/libGLESv1_CM_adreno200.so
D/libEGL(18606): loaded /system/lib/egl/libGLESv2_adreno200.so
I/Adreno200-EGLSUB(18606): <ConfigWindowMatch:2078>: Format RGBA_8888.
D/OpenGLRenderer(18606): Enabling debug mode 0
Main problem is Fatal signal 11 (SIGSEGV) at 0xdeadbaad(code=1)
If anyone know about this... then tell me the reason.
initially, the segmentation fault and, specially the 0xdeadbaad, would mean a memory corruption or similar but, I recently found that, with the NDK, this is also the default behaviour for assertions: on assert fail it sends SIGSEGV, instead of SIGTRAP, and sets the memory pointer to this hex string.
You should check that your code is calling to assert or, in case you're using third party's software, check that you're passing the proper values to every call. A quick way to check this would be building your library with NDEBUG set to 1 (by default if you set APP_OPTIM := release in your Application.mk) and check if you still have exactly the same problem.
Hope this helps.