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.
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
Related Topics
How to Create an Object of an Activity in Other Class
Install/Uninstall Apks Programmatically (Packagemanager VS Intents)
Android Fatal Signal 11 (Sigsegv) At 0X636F7D89 (Code=1). How Can It Be Tracked Down
Android: Go Back to Previous Activity
How to Create Custom Ratings Bar in Android
How to Validate an E-Mail Address
Illegalstateexception: Can Not Perform This Action After Onsaveinstancestate With Viewpager
Post Multipart Form Data Using Retrofit 2.0 Including Image
How to Change the Font on the Textview
How to Do Something Like a Flowlayout in Android
How to Handle Screen Orientation Change When Progress Dialog and Background Thread Active
Removing an Activity from the History Stack
How to Detect If Software Keyboard Is Visible on Android Device or Not
Firebaseinstanceidservice Is Deprecated
Adb Server Version Doesn't Match This Client
Getviewtypecount and Getitemviewtype Methods of Arrayadapter