Cocos2d 3.17.1 crash on android

Crash is shown in GooglePlayConsole:

Android 6.0
Device br6580_weg_emmc_m

signal 11 (SIGSEGV), code 1 (SEGV_MAPERR)

*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
pid: 0, tid: 0

backtrace:
#00 pc 0000000000016bc8 /system/lib/libc.so (__memcpy_base_aligned 64)

#01 pc 00000000005cbf05 /data/app/xxxx/lib/arm/libcocos2djs.so (cocos2d::TextureAtlas::drawNumberOfQuads(int, int) 176)

#02 pc 00000000ffffffff <unknown>

I can’t reproduce it.

Another one:

Samsung Galaxy J2 (j2lte)
Android 5.1

signal 11 (SIGSEGV), code 1 (SEGV_MAPERR)

*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
pid: 0, tid: 0

backtrace:
  #00  pc 00000000000134a8  /system/lib/libc.so (__memcpy_base 100)
  #01  pc 00000000005cbf05  /data/app/xxx-1/lib/arm/libcocos2djs.so (cocos2d::TextureAtlas::drawNumberOfQuads(int, int) 176)
  #02  pc 000000000054ee11  /data/app/xxx-1/lib/arm/libcocos2djs.so (cocos2d::Label::onDraw(cocos2d::Mat4 const&, bool) 176)
  #03  pc 00000000005c5eb5  /data/app/xxx-1/lib/arm/libcocos2djs.so (cocos2d::Renderer::visitRenderQueue(cocos2d::RenderQueue&) 536)
  #04  pc 00000000005c5fdf  /data/app/xxx-1/lib/arm/libcocos2djs.so (cocos2d::Renderer::render() 62)
  #05  pc 0000000000576db5  /data/app/xxx-1/lib/arm/libcocos2djs.so (cocos2d::Scene::render(cocos2d::Renderer*, cocos2d::Mat4 const*, cocos2d::Mat4 const*, unsigned int) 328)
  #06  pc 0000000000576c65  /data/app/xxx-1/lib/arm/libcocos2djs.so (cocos2d::Scene::render(cocos2d::Renderer*, cocos2d::Mat4 const&, cocos2d::Mat4 const*) 22)
  #07  pc 00000000005dca59  /data/app/xxx-1/lib/arm/libcocos2djs.so (cocos2d::Director::drawScene() 180)
  #08  pc 00000000005debe5  /data/app/xxx-1/lib/arm/libcocos2djs.so (cocos2d::Director::mainLoop() 36)
  #09  pc 00000000000e552d  /data/dalvik-cache/arm/data@app@xxx-1@base.apk@classes.dex

One more similar

signal 11 (SIGSEGV), code 1 (SEGV_MAPERR)

Samsung Galaxy J2 (j2lte)
Android 5.1

*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
pid: 0, tid: 0

backtrace:
  #00  pc 00000000000135f0  /system/lib/libc.so (__memcpy_base_aligned 92)
  #01  pc 00000000005cbf05  /data/app/xxx-1/lib/arm/libcocos2djs.so (cocos2d::TextureAtlas::drawNumberOfQuads(int, int) 176)
  #02  pc 000000000054ed33  /data/app/xxx-1/lib/arm/libcocos2djs.so (cocos2d::Label::onDrawShadow(cocos2d::GLProgram*, cocos2d::Color4F const&) 330)
  #03  pc 000000000054ed9f  /data/app/xxx-1/lib/arm/libcocos2djs.so (cocos2d::Label::onDraw(cocos2d::Mat4 const&, bool) 62)
  #04  pc 00000000005c5eb5  /data/app/xxx-1/lib/arm/libcocos2djs.so (cocos2d::Renderer::visitRenderQueue(cocos2d::RenderQueue&) 536)
  #05  pc 00000000005c5fdf  /data/app/xxx-1/lib/arm/libcocos2djs.so (cocos2d::Renderer::render() 62)
  #06  pc 0000000000576db5  /data/app/xxx-1/lib/arm/libcocos2djs.so (cocos2d::Scene::render(cocos2d::Renderer*, cocos2d::Mat4 const*, cocos2d::Mat4 const*, unsigned int) 328)
  #07  pc 0000000000576c65  /data/app/xxx-1/lib/arm/libcocos2djs.so (cocos2d::Scene::render(cocos2d::Renderer*, cocos2d::Mat4 const&, cocos2d::Mat4 const*) 22)
  #08  pc 00000000005dca59  /data/app/xxx-1/lib/arm/libcocos2djs.so (cocos2d::Director::drawScene() 180)
  #09  pc 00000000005debe5  /data/app/xxx-1/lib/arm/libcocos2djs.so (cocos2d::Director::mainLoop() 36)
  #10  pc 00000000000e552d  /data/dalvik-cache/arm/data@app@xxx-1@base.apk@classes.dex

@drelaptop there seem to be some crashes. @dimon4eg says they are not easily reproducible currently. But so you are aware of these…

As I confirmed this PR will reduce those errors.

Typically this error occurs when GL context lost, with this warnings before

call to OpenGL ES API with no current context (logged once per thread)

Your PR is in 3.17.1 and crashes still occur in this version.

Not, this PR didn’t be merged into 3.17.1.

3.17.1 have been tested for 2 round when PR comes, so not

Oh sorry.
I just remembered I merged the PR manually and crashes still occur :neutral_face:

times ago, same issue occurs on a developer, and that PR helps a lot.

he can reproduce it by switch app frequently between Game and another Chat App in the game loading process. warn log call to OpenGL ES API with no current context comes first before the crash occurs

and did you use the android texture restore macro? if so I think the issues occurs frequently if you handle it not so properly.

setPreserveEGLContextOnPause(true) is not guaranteed to fix the issue, as stated in the documentation:

“If set to true, then the EGL context may be preserved when the GLSurfaceView is paused.”

we have same issue on 3.17 C++ version

This is happens after applicationWillEnterForeground event:

20:27:52:715 (UTC) | D/CrashlyticsCore [#DEBUG] | applicationDidEnterBackground > AppDelegate.cpp 161
475 | 20:27:52:771 (UTC) | D/CrashlyticsCore [#DEBUG] | Game saved to /data/user/0/com.hatedonate.lift/files/save.json game_data.cpp 709
476 | 20:27:52:776 (UTC) | D/CrashlyticsCore [#DEBUG] | cUIModalWindow::createFromJSON |window_level_pause.json| ui_modal_window.cpp 496
477 | 20:27:52:826 (UTC) | D/CrashlyticsCore [#DEBUG] | applicationDidEnterBackground < AppDelegate.cpp 179
478 | 20:33:54:370 (UTC) | D/CrashlyticsCore [#DEBUG] | applicationWillEnterForeground > AppDelegate.cpp 184
479 | 20:33:54:373 (UTC) | D/CrashlyticsCore [#DEBUG] | sig_onAppWillEnterForeground |361.00| AppDelegate.cpp 198
480 | 20:33:54:395 (UTC) | D/CrashlyticsCore [#DEBUG] | applicationWillEnterForeground < AppDelegate.cpp 200

Maybe we need this Restart application instead of reload all resources when opengl es context lost on Android

2 Likes