Random Crash on Android (libc : Fatal signal 11)


#1

Using cocos2d-x-2.2 I experience random crashes on Android when launching my application. I Have two kind of crashes.

The first one occurs randomly at the launch of the application for no specific reason I could think of. The error log outputs :

01-17 09:52:11.767: A/libc(9315): Fatal signal 11 (SIGSEGV) at 0x00000000 (code=1), thread 9708 (Thread-16199)

or sometimes :

01-17 09:54:22.347: A/libc(9315): Fatal signal 11 (SIGSEGV) at 0x00000010 (code=1), thread 9708 (Thread-16199)

The second crash occurs when I launch a second Android activity using the same C++/cocos2d-x classes. (I.E. a live wallpaper and a classic activity to interact with).

01-17 09:50:26.705: I/Adreno-ES20(8967): : validate_vertex_attrib_state: No vertex attrib is enabled in a draw call!
01-17 09:50:26.705: A/libc(8967): Fatal signal 11 (SIGSEGV) at 0xf465000d (code=1), thread 9208 (Thread-16185)

Any insights on the reasons of the crash ? Or is there a way to have more details on theses errors?

(For the record I use Linux Fedora 19 to compile)


#2

Most probably, the reason of the crashes is an unitialized class member or dereferencing of nullptr.


#3

Thank you for your hint. I double checked, but it seems highly unprobable about the uninitialized class : I only have ONE class (herited from CCLayer, and containing my animation).
Gotta check for the nullptr though. Is there a way to know where’s the involved pointer ?


#4

I am not sure if it helps but this is the reason I encounter random crash only on Android and how I fix it.

At that time, I am working with migration from 3.0alpha1 to 3.0beta and since API has changed from const char * to std::string & in some parts. For iOS it has no problem but it will have the same case of you on Android.

Maybe you have to set some breakpoints or dump outputs to see at which point the program crash.
This is how I point out the problem. And you may have to make a version to run for Windows, Visual Studio is strict for this kind of problem.