3.17 crashes at CameraBackgroundDepthBrush::drawBackground

3.17 We are getting bunch of crashes logged in Play console from CameraBackgroundDepthBrush::drawBackground. Please anyone have any ideas? Thank you!

*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
pid: 0, tid: 0 >>> com.company.mygame <<<

backtrace:
  #00  pc 0000000000019302  /system/lib/libc.so (__memcpy_base_aligned+69)
  #01  pc 0000000000160a15  /system/vendor/lib/egl/libGLESv2_adreno.so (_ZN20EsxVertexArrayObject18UpdateInternalVbosEPK17EsxDrawDescriptorjPK16EsxAttributeDesc+1176)
  #02  pc 000000000033b817  /system/vendor/lib/egl/libGLESv2_adreno.so (_ZN20A5xVertexArrayObject11CalcVfdRegsEPK17EsxDrawDescriptorP10A5xVfdRegsi+76)
  #03  pc 000000000034d6d9  /system/vendor/lib/egl/libGLESv2_adreno.so (_ZN10A5xContext13ValidateStateEPK17EsxDrawDescriptor+840)
  #04  pc 000000000033f063  /system/vendor/lib/egl/libGLESv2_adreno.so (_ZN10A5xContext18HwValidateGfxStateEPK17EsxDrawDescriptor+4)
  #05  pc 00000000000da461  /system/vendor/lib/egl/libGLESv2_adreno.so (_ZN10EsxContext16ValidateGfxStateEPK17EsxDrawDescriptor+2172)
  #06  pc 00000000000d0757  /system/vendor/lib/egl/libGLESv2_adreno.so (_ZN10EsxContext21DrawElementsInstancedE11EsxPrimTypej10EsxPixTypePKvji+662)
  #07  pc 00000000000f9d05  /system/vendor/lib/egl/libGLESv2_adreno.so (_ZN21EsxGlApiParamValidate14GlDrawElementsEP11EsxDispatchjijPKv+192)
  #08  pc 000000000009e633  /system/vendor/lib/egl/libGLESv2_adreno.so (glDrawElements+42)
  #09  pc 000000000044dbbc  /data/app/com.company.mygame-lRkxA-2A-srCSJ9G_9sxxQ==/lib/arm/libMyGame.so (_ZN7cocos2d26CameraBackgroundDepthBrush14drawBackgroundEPNS_6CameraE+236)
  #10  pc 000000000049f348  /data/app/com.company.mygame-lRkxA-2A-srCSJ9G_9sxxQ==/lib/arm/libMyGame.so (_ZN7cocos2d5Scene6renderEPNS_8RendererEPKNS_4Mat4ES5_j+460)
  #11  pc 000000000049f170  /data/app/com.company.mygame-lRkxA-2A-srCSJ9G_9sxxQ==/lib/arm/libMyGame.so (_ZN7cocos2d5Scene6renderEPNS_8RendererERKNS_4Mat4EPS4_+28)
  #12  pc 00000000005001c0  /data/app/com.company.mygame-lRkxA-2A-srCSJ9G_9sxxQ==/lib/arm/libMyGame.so (_ZN7cocos2d8Director9drawSceneEv+428)
  #13  pc 0000000000503230  /data/app/com.company.mygame-lRkxA-2A-srCSJ9G_9sxxQ==/lib/arm/libMyGame.so (_ZN7cocos2d8Director8mainLoopEv+132)
  #14  pc 000000000007d217  /data/app/com.company.mygame-lRkxA-2A-srCSJ9G_9sxxQ==/oat/arm/base.odex

Do you use Android NDK 16?

Yes android-ndk-r16b

@CrazyHappyGame is that causing the issue?

It is better to use NDK16 (because all android libs were compiled with NDK16) but NDK16b should work as well.

Please add more info here.
It seems like the same problems exists for ios/mac and older versions

I have it on cocos2d-x3.15 in Google Play. Unfortunately I can not reproduce it on my devices …

Anyone can help on this issue?

How are you checking the depth?

Not sure what you mean?

I was wondering if you are using the camera to check the depth of your scene, like for example if an object is near or far away from the camera, etc.

No, I am not checking for depth of scene.

@slackmoehrle please check call stack. Crash is inside cocos2d::Director::drawScene

umm, yeah, I totally see that. My question to OP was how does he think he got there? Is he doing anything we should know about? Is he using a camera in anyway to check objects for proximity to the camera, etc? OP also reports seeing this in the console: CameraBackgroundDepthBrush::drawBackground so I was trying to think about how this might happen.

We are not doing anything crazy and no customizations. Just the standard stuff that comes with cocos2d-x

Thanks. it looks like there are only a handful of times this is actually called. Let’s create a bug report for this.

I see the same crash in Google Play. Can not reproduce it…
My app is very simple: Few Sprites, Labels, Particles and Actions.
It looks like memory corruption - crash inside memcpy

There is one exactly for that particular issue:

Thanks, I hadn’t yet checked.

1 Like

Looks like @minggo might have fix, please can anyone here verify?

Thanks!

@slackmoehrle Do we know if this is a good fix?

I’ve updated my app to cocos 3.17.2 and it has fixed the crash.

1 Like