Please Help! . Problem with Cocos2d 1.0.1-x-0.12.0. Random Signal 11 error


#1

Hi all,
First of all I want to give a big Thanks to everybody here that is working very hard for the community.
We have a game developed since last year and now, we are developing new features.
The problem is that once everything is done and “working” and ready to be uploaded, we are getting a random error:

* Crash dump:*
Build fingerprint: ‘samsung/m0xx/m0:4.1.2/JZO54K/I9300XXELLA:user/release-keys’
pid: 21723, tid: 21768, name: Thread-18076 >>> org.cocos2dx.hudrfactor <<<
signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 00000000
Stack frame #00 pc 0016a69a /data/data/org.cocos2dx.hudrfactor/lib/libgame.so (cocos2d::CCActionManager::update(float)+257)
Stack frame #01 pc 00156b9d /data/data/org.cocos2dx.hudrfactor/lib/libgame.so (cocos2d::CCScheduler::tick(float)+188)
Stack frame #02 pc 001768a9 /data/data/org.cocos2dx.hudrfactor/lib/libgame.so (cocos2d::CCDirector::drawScene()+44)
Stack frame #03 pc 00177baf /data/data/org.cocos2dx.hudrfactor/lib/libgame.so (cocos2d::CCDisplayLinkDirector::mainLoop()+50)
Stack frame #04 pc 001a35dd /data/data/org.cocos2dx.hudrfactor/lib/libgame.so (Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeRender+20)
Stack frame #05 pc 0001deb0 /system/lib/libdvm.so (dvmPlatformInvoke+112)
Stack frame #06 pc 0004d103 /system/lib/libdvm.so (dvmCallJNIMethod(unsigned int const**, JValue**, Method const**, Thread**)+394)
Stack frame #07 pc 00000214 /dev/ashmem/dalvik-jit-code-cache (deleted)

We are getting crazy because is a random error, we have tested in a Samsung Galaxy S I and it needs about 10 minutes to give this error , but in a Samsung Galaxy S III, the problem arise in two / three minutes …. each time in a new place.
We have been looking for a fix, but we are now desperate…
I know that probably upgrading to Cocos2d x 2.0 we can get a stable version of the game, but this is a HUGE change we think…
Please any advise, whatever you think about it, will be more than welcome, we are desperate as I said![](.

Thank you very much for your help)


#2

Looking at ther error, this seems like you are trying to access a null pointer.
So you might want to check were exactly the application crashes:

Locate your android-ndk installation directory and check toolchains//prebuilt/linux-x86/bin
(If you are on windows, you should select the appropriate folder for the windows platform).
I’m not sure on the default toolchain for the latest NDK, i think it is arm-linux-androideabi-4.7, but I am not sure on that.

Within the bin directory you should see a executable called arm-linux-androideabi-addr2line.
You can use this to map the pc values to actual source code lines.

Open a terminal and type the following:
cd
arm-linux-androideabi-addr2line -e <path-to-your-libgame.so>

In your example the address would be 0x0016a69a for the line inside cocos2d::CCActionManager::update() If you do not get any output, make sure you compile your code with NDK\_DEBUG=1.

You can also try to debug the native code with eclipse, so you can inspect the variables when the crash occurs.
If you are on linux you can also try to profile a linux build using valgrind, as this may give you more information on where the error comes from.


#3

Andre Rudlaff wrote:

Looking at ther error, this seems like you are trying to access a null pointer.
So you might want to check were exactly the application crashes:
>
Locate your android-ndk installation directory and check toolchains//prebuilt/linux-x86/bin
(If you are on windows, you should select the appropriate folder for the windows platform).
I’m not sure on the default toolchain for the latest NDK, i think it is arm-linux-androideabi-4.7, but I am not sure on that.
>
Within the bin directory you should see a executable called arm-linux-androideabi-addr2line.
You can use this to map the pc values to actual source code lines.
>
Open a terminal and type the following:
cd
arm-linux-androideabi-addr2line e <path-to-your-libgame.so> <address of the stack-frame you want to translate>
>
In your example the address would be 0x0016a69a for the line inside cocos2d::CCActionManager::update
If you do not get any output, make sure you compile your code with NDK_DEBUG=1.
>
You can also try to debug the native code with eclipse, so you can inspect the variables when the crash occurs.
If you are on linux you can also try to profile a linux build using valgrind, as this may give you more information on where the error comes from.
Thank you Andree for your help.
We have gotten this trace with > adb logcat | ndk-stack
sym …. and is not pointing to our code, but cocos2d x code… . : http://stackoverflow.com/questions/5314036/how-to-use-addr2line-in-android
I don’t know if arm-linux-androideabi-addr2line will give us more info about the problem.


#4

I was never able to get meaningful results from the ndk-stack tool.
addr2line will give you more info on the problem, as it will point out the exact source line within CCActionManager. This may give further clues on why the application crashed there.
You are right that it points to cocos2dx code, however it is still possible that something in your code is wrong, which will trigger this issue.