Android Fatal signal 11 (SIGSEGV) at 0x636f7d89 (code=1). How can it be tracked down?
I found the problem. I don't think this will help a lot of others trying to track down their personal SIGSEGV, but mine (and it was very hard) was entirely related to this:
https://code.google.com/p/android/issues/detail?id=8709
The libcrypto.so in my dump kind of clued me in. I do a MD5 hash of packet data when trying to determine if I've already seen the packet, and skipping it if I had. I thought at one point this was an ugly threading issue related to tracking those hashes, but it turned out it was the java.security.MessageDigest class! It's not thread safe!
I swapped it out with a UID I was stuffing in every packet based on the device UUID and a timestamp. No problems since.
I guess the lesson I can impart to those that were in my situation is, even if you're a 100% Java application, pay attention to the native library and symbol noted in the crash dump for clues. Googling for SIGSEGV + the lib .so name will go a lot farther than the useless code=1, etc... Next think about where your Java app could touch native code, even if it's nothing you're doing. I made the mistake of assuming it was a Service + UI threading issue where the Canvas was drawing something that was null, (the most common case I Googled on SIGSEGV) and ignored the possibility it could have been completely related to code I wrote that was related to the lib .so in the crash dump. Naturally java.security would use a native component in libcrypto.so for speed, so once I clued in, I Googled for Android + SIGSEGV + libcrypto.so and found the documented issue.
How to solve Android Fatal signal 11 (SIGSEGV), code 1, fault addr 0x0 in tid xxxxx (Thread-X)?
After some discussion it became clear that the problem was with interaction with memory:
extern "C"
jdouble
JNICALL Java_com_foo(JNIEnv *env, jclass type, jlong addrRgba, jlong addrGray) {
Mat &mRgb = *(Mat *) addrRgba;
Mat &mGray = *(Mat *) addrGray;
return (jdouble) toGray(mRgb, mGray);
}
As a quick fix double toGray(Mat& rgb, Mat& gray);
had to be changed to double toGray(Mat rgb, Mat gray)
Additional information can be found on topic CvMat deep copy
Android error: Fatal signal 11 (SIGSEGV) leads to app crash
I recommend to use a debugger and query more information about the crash (e.g. LLDB). Sometimes you do not even need to set up breakpoints, since the debugger can stop when it catches an error and show you the problematic code (It can be on the native side).
According to this question, bad memory access can lead to SIGSEGV.
Watch out for memory leaks in your app, make sure you are not holding any references to killed Context objects and etc.
Related Topics
How to Display a Pdf Via Android Web Browser Without "Downloading" First
How to Get Minutes Difference Between Two Time in Android
Remove Old Fragment from Fragment Manager
How to Separate a Country Code from a Phone Number in Android
How to Get the Timezone Offset in Gmt(Like Gmt+7:00) from Android Device
Android: Rotate Image in Imageview by an Angle
How Capture/Log API Calls (Function Calls) Made by Android App
Android: How to Send an Image as Email Attachment from Application
Retrofit:Getting Error ** End of Input At Line 1 Column 1**
Fastest Way to Upload Multiple Image to Server in Android
How to Get Imsi Number in Android Using Command Line
Notification Disappears After Showing
How to Make a Link Open an Instagram Page in an App Installed on Android
Remove Span Tag With Text from String
How to Access the Camera from Within a Webview
How to Send a Firebase Notification to All Devices Via Curl