Crash on Cocos2d::TextureAtlas::drawNumberOfQuads cocos2d-x version 3.17.2

Play console crash log

backtrace:
#00 pc 000000000001abd4 /system/lib64/libc.so (memcpy+332)
#01 pc 0000000000dac57c /data/app/com.dinogo.catarmy-1/lib/arm64/libMyGame.so (_ZN7cocos2d12TextureAtlas17drawNumberOfQuadsEll+144)
#02 pc 0000000000cc8a40 /data/app/com.dinogo.catarmy-1/lib/arm64/libMyGame.so (_ZN7cocos2d5Label12onDrawShadowEPNS_9GLProgramERKNS_7Color4FE+408)
#03 pc 0000000000cc8acc /data/app/com.dinogo.catarmy-1/lib/arm64/libMyGame.so (_ZN7cocos2d5Label6onDrawERKNS_4Mat4Eb+84)
#04 pc 0000000000da180c /data/app/com.dinogo.catarmy-1/lib/arm64/libMyGame.so (_ZN7cocos2d8Renderer20processRenderCommandEPNS_13RenderCommandE+104)
#05 pc 0000000000da22f0 /data/app/com.dinogo.catarmy-1/lib/arm64/libMyGame.so (_ZN7cocos2d8Renderer16visitRenderQueueERNS_11RenderQueueE+824)
#06 pc 0000000000da2484 /data/app/com.dinogo.catarmy-1/lib/arm64/libMyGame.so (_ZN7cocos2d8Renderer6renderEv+112)
#07 pc 0000000000cf209c /data/app/com.dinogo.catarmy-1/lib/arm64/libMyGame.so (_ZN7cocos2d5Scene6renderEPNS_8RendererEPKNS_4Mat4ES5_j+464)
#08 pc 0000000000d501d4 /data/app/com.dinogo.catarmy-1/lib/arm64/libMyGame.so (_ZN7cocos2d8Director9drawSceneEv+352)
#09 pc 0000000000d52da8 /data/app/com.dinogo.catarmy-1/lib/arm64/libMyGame.so (_ZN7cocos2d8Director8mainLoopEv+128)
#10 pc 0000000000bdc2fc /data/app/com.dinogo.catarmy-1/oat/arm64/base.odex

In previous game version i think crash cause by ads rewarded video. When callback finish ads i already run function in performFunctionInCocosThread. Because my function callback have some code modify UI element like Text,Button…In this version i think that code not safe, so i use a flag to check finish reward on function callback and run function modify UI on cocos main thread update. It still crash. How can i fix this crash…

@slackmoehrle can you help me?

Sure, let me ask the engineering team to take a look.

@zhangxm @coulsonwang

Could you please provide a test case to reproduce it?

It hard to preproduce. I try set CC_TEXTURE_ATLAS_USE_VAO to 0 because i think some android device not support VAO but it still crash. And new crash log below. This crash happens often when i upgrade to cocos 3.17.2

#00 pc 000000000001e058 /system/lib64/libc.so (memcpy+232)
#01 pc 00000000001d0d44 /vendor/lib64/egl/libGLESv2_adreno.so (EsxVertexArrayObject::UpdateInternalVbos(EsxDrawDescriptor const*, unsigned int, EsxAttributeDesc const*)+1644)
#02 pc 00000000003374f4 /vendor/lib64/egl/libGLESv2_adreno.so (A5xVertexArrayObject::CalcVfdRegs(EsxDrawDescriptor const*, A5xVfdRegs*, int)+892)
#03 pc 000000000034ff54 /vendor/lib64/egl/libGLESv2_adreno.so (A5xContext::ValidateState(EsxDrawDescriptor const*)+1212)
#04 pc 000000000033c820 /vendor/lib64/egl/libGLESv2_adreno.so (A5xContext::HwValidateGfxState(EsxDrawDescriptor const*)+16)
#05 pc 0000000000115158 /vendor/lib64/egl/libGLESv2_adreno.so (EsxContext::ValidateGfxState(EsxDrawDescriptor const*)+1968)
#06 pc 000000000010c644 /vendor/lib64/egl/libGLESv2_adreno.so (EsxContext::DrawElementsInstanced(EsxPrimType, unsigned int, EsxPixType, void const*, unsigned int, int)+972)
#07 pc 0000000000dae664 /data/app/com.dinogo.catarmy-34Oo3QnT7Fv9iqAbhGn7uQ==/lib/arm64/libMyGame.so (cocos2d::TextureAtlas::drawNumberOfQuads(long, long)+424)
#08 pc 0000000000ccba10 /data/app/com.dinogo.catarmy-34Oo3QnT7Fv9iqAbhGn7uQ==/lib/arm64/libMyGame.so (cocos2d::label::onDrawShadow(cocos2d::GLProgram*, cocos2d::Color4F const&)+408)
#09 pc 0000000000ccba9c /data/app/com.dinogo.catarmy-34Oo3QnT7Fv9iqAbhGn7uQ==/lib/arm64/libMyGame.so (cocos2d::label::onDraw(cocos2d::Mat4 const&, bool)+84)
#10 pc 0000000000da37dc /data/app/com.dinogo.catarmy-34Oo3QnT7Fv9iqAbhGn7uQ==/lib/arm64/libMyGame.so (cocos2d::Renderer::processRenderCommand(cocos2d::RenderCommand*)+104)
#11 pc 0000000000da42c0 /data/app/com.dinogo.catarmy-34Oo3QnT7Fv9iqAbhGn7uQ==/lib/arm64/libMyGame.so (cocos2d::Renderer::visitRenderQueue(cocos2d::RenderQueue&)+824)
#12 pc 0000000000da4454 /data/app/com.dinogo.catarmy-34Oo3QnT7Fv9iqAbhGn7uQ==/lib/arm64/libMyGame.so (cocos2d::Renderer::render()+112)
#13 pc 0000000000cf506c /data/app/com.dinogo.catarmy-34Oo3QnT7Fv9iqAbhGn7uQ==/lib/arm64/libMyGame.so (cocos2d::Scene::render(cocos2d::Renderer*, cocos2d::Mat4 const*, cocos2d::Mat4 const*, unsigned int)+464)
#14 pc 0000000000d531a4 /data/app/com.dinogo.catarmy-34Oo3QnT7Fv9iqAbhGn7uQ==/lib/arm64/libMyGame.so (cocos2d::Director::drawScene()+352)
#15 pc 0000000000d55d78 /data/app/com.dinogo.catarmy-34Oo3QnT7Fv9iqAbhGn7uQ==/lib/arm64/libMyGame.so (cocos2d::Director::mainLoop()+128)
#16 pc 00000000000012c0 /data/app/com.dinogo.catarmy-34Oo3QnT7Fv9iqAbhGn7uQ==/oat/arm64/base.odex (deleted) (offset 0x3c000)

same issue faced after upgraded to cocos 3.17.2

May be it is caused by this PR: https://github.com/cocos2d/cocos2d-x/pull/19256.

I see some code added in 3.17.2
in Cocos2dxActivity.java this.mGLSurfaceView.setPreserveEGLContextOnPause(true);

I think it make crash. Because i dont see above crash when use 3.17.1

I see a issues. Last 6 day ago. A guy post that case and how preproduce it. You can review it

1 Like

Same error in 3.17.2
Is there any progress?