cocos / cocos-engine

Cocos simplifies game creation and distribution with Cocos Creator, a free, open-source, cross-platform game engine. Empowering millions of developers to create high-performance, engaging 2D/3D games and instant web entertainment.
https://www.cocos.com/en/creator
Other
8.82k stars 2.05k forks source link

[3.5.2]Some crash report #13507

Closed xjtulk closed 1 year ago

xjtulk commented 2 years ago

Cocos Creator version

3.5.2

System information

android

Issue description

Our team develop an android application with a game inside.

Our little modifies about the engine are collected in the commit below https://github.com/xjtulk/cocos-engine/commit/98015262bfadcbf481a80862589575c2784aaabd

After the application published on google play, we receive some online crash report and the crash rate related to cocos engine has reached 1% (a pretty high rate).Here are some main crash stacks below, after spending some time analyze the crash, we get nothing so we hope you can give some advice about the problem.(The first crash is a bit similar to the problem mentioned in https://github.com/cocos/cocos-engine/pull/11348 and we are testing if the crash fixed after apply the modify on our branch)

backtrace:

00 pc 0000000000a61bf4 /data/app/com.netease.ruffgo-t8xbfhzlG0d6FdzmY06kvw==/split_config.arm64_v8a.apk!/lib/arm64-v8a/libcocos.so (_ZN2cc12MessageQueue15executeMessagesEv+120)

#01 pc 0000000000a61748  /data/app/com.netease.ruffgo-t8xbfhzlG0d6FdzmY06kvw==/split_config.arm64_v8a.apk!/lib/arm64-v8a/libcocos.so (_ZN2cc12MessageQueue18consumerThreadLoopEv+60)
#02 pc 0000000000a62f90  /data/app/com.netease.ruffgo-t8xbfhzlG0d6FdzmY06kvw==/split_config.arm64_v8a.apk!/lib/arm64-v8a/libcocos.so (_ZNSt6__ndk114__thread_proxyINS_5tupleIJNS_10unique_ptrINS_15__thread_structENS_14default_deleteIS3_EEEEMN2cc12MessageQueueEFvvEPS8_EEEEEPvSD_+68)
#03 pc 00000000000e3b28  /apex/com.android.runtime/lib64/bionic/libc.so
#04 pc 0000000000085334  /apex/com.android.runtime/lib64/bionic/libc.so
#05 pc 0000000000000000  <unknown>

backtrace:

00 pc 00000000007b23ec /data/app/com.netease.ruffgo-GWUc51vxmORF-XwIjAcVjQ==/split_config.arm64_v8a.apk!/lib/arm64-v8a/libcocos.so (_ZN2cc6Engine9restartVMEv+44)

#01 pc 00000000007b22d0  /data/app/com.netease.ruffgo-GWUc51vxmORF-XwIjAcVjQ==/split_config.arm64_v8a.apk!/lib/arm64-v8a/libcocos.so (_ZN2cc6Engine4tickEv+56)
#02 pc 00000000007b6cd0  /data/app/com.netease.ruffgo-GWUc51vxmORF-XwIjAcVjQ==/split_config.arm64_v8a.apk!/lib/arm64-v8a/libcocos.so (_ZN2cc15AndroidPlatform4loopEv+40)
#03 pc 00000000007b73f0  /data/app/com.netease.ruffgo-GWUc51vxmORF-XwIjAcVjQ==/split_config.arm64_v8a.apk!/lib/arm64-v8a/libcocos.so
#04 pc 00000000000e6a14  /apex/com.android.runtime/lib64/bionic/libc.so
#05 pc 0000000000084c70  /apex/com.android.runtime/lib64/bionic/libc.so
#06 pc 0000000000000000  <unknown>

backtrace:

00 pc 000000000004deec /apex/com.android.runtime/lib64/bionic/libc.so

#01 pc 0000000000da8500  /data/app/~~XbYJ6GFj2S_8qukF79-cMg==/com.netease.ruffgo-pK3MohNQkgqEj5B5wlOgMw==/split_config.arm64_v8a.apk!/lib/arm64-v8a/libcocos.so
#02 pc 0000000000da2480  /data/app/~~XbYJ6GFj2S_8qukF79-cMg==/com.netease.ruffgo-pK3MohNQkgqEj5B5wlOgMw==/split_config.arm64_v8a.apk!/lib/arm64-v8a/libcocos.so (_ZN2v88internal6LoggerD1Ev+156)
#03 pc 0000000000da24d8  /data/app/~~XbYJ6GFj2S_8qukF79-cMg==/com.netease.ruffgo-pK3MohNQkgqEj5B5wlOgMw==/split_config.arm64_v8a.apk!/lib/arm64-v8a/libcocos.so (_ZN2v88internal6LoggerD0Ev+20)
#04 pc 0000000000c841f0  /data/app/~~XbYJ6GFj2S_8qukF79-cMg==/com.netease.ruffgo-pK3MohNQkgqEj5B5wlOgMw==/split_config.arm64_v8a.apk!/lib/arm64-v8a/libcocos.so (_ZN2v88internal7IsolateD1Ev+204)
#05 pc 0000000000c82794  /data/app/~~XbYJ6GFj2S_8qukF79-cMg==/com.netease.ruffgo-pK3MohNQkgqEj5B5wlOgMw==/split_config.arm64_v8a.apk!/lib/arm64-v8a/libcocos.so (_ZN2v88internal7Isolate6DeleteEPS1_+136)
#06 pc 0000000000829b54  /data/app/~~XbYJ6GFj2S_8qukF79-cMg==/com.netease.ruffgo-pK3MohNQkgqEj5B5wlOgMw==/split_config.arm64_v8a.apk!/lib/arm64-v8a/libcocos.so (_ZN2se12ScriptEngine7cleanupEv+448)
#07 pc 00000000007b242c  /data/app/~~XbYJ6GFj2S_8qukF79-cMg==/com.netease.ruffgo-pK3MohNQkgqEj5B5wlOgMw==/split_config.arm64_v8a.apk!/lib/arm64-v8a/libcocos.so (_ZN2cc6Engine9restartVMEv+108)
#08 pc 00000000007b22d0  /data/app/~~XbYJ6GFj2S_8qukF79-cMg==/com.netease.ruffgo-pK3MohNQkgqEj5B5wlOgMw==/split_config.arm64_v8a.apk!/lib/arm64-v8a/libcocos.so (_ZN2cc6Engine4tickEv+56)
#09 pc 00000000007b6cd0  /data/app/~~XbYJ6GFj2S_8qukF79-cMg==/com.netease.ruffgo-pK3MohNQkgqEj5B5wlOgMw==/split_config.arm64_v8a.apk!/lib/arm64-v8a/libcocos.so (_ZN2cc15AndroidPlatform4loopEv+40)
#10 pc 00000000007b73f0  /data/app/~~XbYJ6GFj2S_8qukF79-cMg==/com.netease.ruffgo-pK3MohNQkgqEj5B5wlOgMw==/split_config.arm64_v8a.apk!/lib/arm64-v8a/libcocos.so
#11 pc 00000000000eb654  /apex/com.android.runtime/lib64/bionic/libc.so
#12 pc 000000000008aef8  /apex/com.android.runtime/lib64/bionic/libc.so
#13 pc 0000000000000000  <unknown>

backtrace:

00 pc 0000000000a94e1c /data/app/com.netease.ruffgo-EErd9D-3HXQXAdJ_dcwEgg==/split_config.arm64_v8a.apk!/lib/arm64-v8a/libcocos.so

#01 pc 0000000000a94c80  /data/app/com.netease.ruffgo-EErd9D-3HXQXAdJ_dcwEgg==/split_config.arm64_v8a.apk!/lib/arm64-v8a/libcocos.so (_ZN2cc3gfx29cmdFuncGLES3CreateFramebufferEPNS0_11GLES3DeviceEPNS0_19GLES3GPUFramebufferE+268)
#02 pc 0000000000a994d0  /data/app/com.netease.ruffgo-EErd9D-3HXQXAdJ_dcwEgg==/split_config.arm64_v8a.apk!/lib/arm64-v8a/libcocos.so (_ZN2cc3gfx22GLES3GPUFramebufferHub6updateEPNS0_15GLES3GPUTextureE+112)
#03 pc 0000000000a3d410  /data/app/com.netease.ruffgo-EErd9D-3HXQXAdJ_dcwEgg==/split_config.arm64_v8a.apk!/lib/arm64-v8a/libcocos.so (_ZN2cc3gfx12GLES3Texture8doResizeEjjj+124)
#04 pc 0000000000881a98  /data/app/com.netease.ruffgo-EErd9D-3HXQXAdJ_dcwEgg==/split_config.arm64_v8a.apk!/lib/arm64-v8a/libcocos.so (_ZN2cc3gfx7Texture6resizeEjj+228)
#05 pc 0000000000a3cec4  /data/app/com.netease.ruffgo-EErd9D-3HXQXAdJ_dcwEgg==/split_config.arm64_v8a.apk!/lib/arm64-v8a/libcocos.so (_ZN2cc3gfx14GLES3Swapchain8doResizeEjjNS0_16SurfaceTransformE+36)
#06 pc 0000000000a61c14  /data/app/com.netease.ruffgo-EErd9D-3HXQXAdJ_dcwEgg==/split_config.arm64_v8a.apk!/lib/arm64-v8a/libcocos.so (_ZN2cc12MessageQueue15executeMessagesEv+152)
#07 pc 0000000000a61748  /data/app/com.netease.ruffgo-EErd9D-3HXQXAdJ_dcwEgg==/split_config.arm64_v8a.apk!/lib/arm64-v8a/libcocos.so (_ZN2cc12MessageQueue18consumerThreadLoopEv+60)
#08 pc 0000000000a62f90  /data/app/com.netease.ruffgo-EErd9D-3HXQXAdJ_dcwEgg==/split_config.arm64_v8a.apk!/lib/arm64-v8a/libcocos.so (_ZNSt6__ndk114__thread_proxyINS_5tupleIJNS_10unique_ptrINS_15__thread_structENS_14default_deleteIS3_EEEEMN2cc12MessageQueueEFvvEPS8_EEEEEPvSD_+68)
#09 pc 00000000000d0a18  /apex/com.android.runtime/lib64/bionic/libc.so
#10 pc 000000000007091c  /apex/com.android.runtime/lib64/bionic/libc.so
#11 pc 0000000000000000  <unknown>

backtrace:

00 pc 000000000001c6d8 /system/lib64/libc.so (memcpy+232)

#01 pc 0000000000a0d2a0  /data/app/com.netease.ruffgo-eNgm81A9EnQXmUhSFRPn2g==/split_config.arm64_v8a.apk!/lib/arm64-v8a/libcocos.so (_ZN2cc3gfx19doBufferTextureCopyINS0_6DeviceEEEvPKPKhPNS0_7TextureEPKNS0_17BufferTextureCopyEjPNS_12MessageQueueEPT_+484)
#02 pc 00000000009ccc58  /data/app/com.netease.ruffgo-eNgm81A9EnQXmUhSFRPn2g==/split_config.arm64_v8a.apk!/lib/arm64-v8a/libcocos.so (_Z36js_gfx_Device_copyTexImagesToTextureRN2se5StateE+680)
#03 pc 00000000009ccde8  /data/app/com.netease.ruffgo-eNgm81A9EnQXmUhSFRPn2g==/split_config.arm64_v8a.apk!/lib/arm64-v8a/libcocos.so (_Z44js_gfx_Device_copyTexImagesToTextureRegistryRKN2v820FunctionCallbackInfoINS_5ValueEEE+136)
#04 pc 0000000001230c9c  /data/app/com.netease.ruffgo-eNgm81A9EnQXmUhSFRPn2g==/split_config.arm64_v8a.apk!/lib/arm64-v8a/libcocos.so (_ZN2v88internal25FunctionCallbackArguments4CallENS0_15CallHandlerInfoE+552)
#05 pc 00000000012302f8  /data/app/com.netease.ruffgo-eNgm81A9EnQXmUhSFRPn2g==/split_config.arm64_v8a.apk!/lib/arm64-v8a/libcocos.so
#06 pc 000000000122fa88  /data/app/com.netease.ruffgo-eNgm81A9EnQXmUhSFRPn2g==/split_config.arm64_v8a.apk!/lib/arm64-v8a/libcocos.so
#07 pc 00000000011449ac  /data/app/com.netease.ruffgo-eNgm81A9EnQXmUhSFRPn2g==/split_config.arm64_v8a.apk!/lib/arm64-v8a/libcocos.so

Relevant error log output

No response

Steps to reproduce

The crash may not be easy to reproduce offline, we use auto test tools to frequently enter and exit game page and sometimes the crash happens with low probability.

Minimal reproduction project

We create a demo project without some business code but the main logic is same as release version. The so filein the project is not stripped and with debug symbols so you can analyze the crash stack above with it.

https://github.com/xjtulk/Cocosdemo/tree/main

xjtulk commented 2 years ago

The crash source code stacks parsed with android ndk address-2-line are listed below:

_ZNK2cc7Message7getNextEv /Applications/CocosCreator/Creator/3.5.2/CocosCreator.app/Contents/Resources/resources/3d/engine/native/cocos/base/threading/MessageQueue.h:61 _ZN2cc12MessageQueue13flushMessagesEv /Applications/CocosCreator/Creator/3.5.2/CocosCreator.app/Contents/Resources/resources/3d/engine/native/cocos/base/threading/MessageQueue.cpp:216 _ZNSt6ndk110unique_ptrINS_15thread_structENS_14default_deleteIS1EEE5resetEPS1 /Users/lukang/Library/Android/sdk/ndk/20.1.5948944/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/usr/include/c++/v1/memory:2649 ?? ??:0

_ZN2cc6Engine9restartVMEv /Applications/CocosCreator/Creator/3.5.2/CocosCreator.app/Contents/Resources/resources/3d/engine/native/cocos/engine/Engine.cpp:238 _ZN2cc6Engine4tickEv /Applications/CocosCreator/Creator/3.5.2/CocosCreator.app/Contents/Resources/resources/3d/engine/native/cocos/engine/Engine.cpp:201 _ZN2cc15AndroidPlatform4loopEv /Applications/CocosCreator/Creator/3.5.2/CocosCreator.app/Contents/Resources/resources/3d/engine/native/cocos/platform/android/AndroidPlatform.cpp:83 operator() /Applications/CocosCreator/Creator/3.5.2/CocosCreator.app/Contents/Resources/resources/3d/engine/native/cocos/platform/android/AndroidPlatform.cpp:62

_ZNKSt6ndk114defaultdeleteIN2v88internal3LogEEclEPS3 :? _ZN2v88internal6LoggerD1Ev :? _ZN2v88internal6LoggerD0Ev :? _ZN2v88internal7IsolateD2Ev :? ZN2v88internal7Isolate6DeleteEPS1 :? _ZNSt6ndk16vectorINS_8functionIFvvEEENS_9allocatorIS3_EEE5beginEv /Users/lukang/Library/Android/sdk/ndk/20.1.5948944/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/usr/include/c++/v1/vector:1511 _ZN2cc3gfx13DeviceManager7destroyEv /Applications/CocosCreator/Creator/3.5.2/CocosCreator.app/Contents/Resources/resources/3d/engine/native/cocos/renderer/GFXDeviceManager.h:102 _ZN2cc6Engine4tickEv /Applications/CocosCreator/Creator/3.5.2/CocosCreator.app/Contents/Resources/resources/3d/engine/native/cocos/engine/Engine.cpp:201 _ZN2cc15AndroidPlatform4loopEv /Applications/CocosCreator/Creator/3.5.2/CocosCreator.app/Contents/Resources/resources/3d/engine/native/cocos/platform/android/AndroidPlatform.cpp:83 operator() /Applications/CocosCreator/Creator/3.5.2/CocosCreator.app/Contents/Resources/resources/3d/engine/native/cocos/platform/android/AndroidPlatform.cpp:62

_ZN2cc3gfxL20getSwapchainIfExistsERKNSt6ndk16vectorIPNS0_19GLES3GPUTextureViewENS1_9allocatorIS4_EEEEPKjm /Applications/CocosCreator/Creator/3.5.2/CocosCreator.app/Contents/Resources/resources/3d/engine/native/cocos/renderer/gfx-gles3/GLES3Commands.cpp:1545 _ZNSt6ndk111__wrap_iterIPN2cc3gfx11SubpassInfoEEppEv /Users/lukang/Library/Android/sdk/ndk/20.1.5948944/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/usr/include/c++/v1/iterator:1390 _ZN2cc3gfx22GLES3GPUFramebufferHub6updateEPNS0_15GLES3GPUTextureE /Applications/CocosCreator/Creator/3.5.2/CocosCreator.app/Contents/Resources/resources/3d/engine/native/cocos/renderer/gfx-gles3/GLES3Commands.cpp:3110 _ZN2cc3gfx12GLES3Texture8doResizeEjjj /Applications/CocosCreator/Creator/3.5.2/CocosCreator.app/Contents/Resources/resources/3d/engine/native/cocos/renderer/gfx-gles3/GLES3Texture.cpp:121 _ZNK2cc3gfx7Texture13isTextureViewEv /Applications/CocosCreator/Creator/3.5.2/CocosCreator.app/Contents/Resources/resources/3d/engine/native/cocos/renderer/gfx-base/GFXTexture.h:49 _ZN2cc3gfx14GLES3Swapchain8doResizeEjjNS0_16SurfaceTransformE /Applications/CocosCreator/Creator/3.5.2/CocosCreator.app/Contents/Resources/resources/3d/engine/native/cocos/renderer/gfx-gles3/GLES3Swapchain.cpp:146 _ZN2cc12MessageQueue15executeMessagesEv /Applications/CocosCreator/Creator/3.5.2/CocosCreator.app/Contents/Resources/resources/3d/engine/native/cocos/base/threading/MessageQueue.cpp:231 _ZN2cc12MessageQueue13flushMessagesEv /Applications/CocosCreator/Creator/3.5.2/CocosCreator.app/Contents/Resources/resources/3d/engine/native/cocos/base/threading/MessageQueue.cpp:216

_ZN2cc3gfx19doBufferTextureCopyINS0_6DeviceEEEvPKPKhPNS0_7TextureEPKNS0_17BufferTextureCopyEjPNS12MessageQueueEPT /Applications/CocosCreator/Creator/3.5.2/CocosCreator.app/Contents/Resources/resources/3d/engine/native/cocos/renderer/gfx-agent/DeviceAgent.cpp:307 _Z36js_gfx_Device_copyTexImagesToTextureRN2se5StateE :? _Z44js_gfx_Device_copyTexImagesToTextureRegistryRKN2v820FunctionCallbackInfoINS_5ValueEEE /Applications/CocosCreator/Creator/3.5.2/CocosCreator.app/Contents/Resources/resources/3d/engine/native/cocos/bindings/manual/jsb_gfx_manual.cpp:186 _ZN2v88internal25FunctionCallbackArguments4CallENS0_15CallHandlerInfoE :? _ZN2v88internal12_GLOBAL__N_119HandleApiCallHelperILb0EEENS0_11MaybeHandleINS0_6ObjectEEEPNS0_7IsolateENS0_6HandleINS0_10HeapObjectEEESA_NS8_INS0_20FunctionTemplateInfoEEENS8_IS4_EENS0_16BuiltinArgumentsE :? _ZN2v88internalL26Builtin_Impl_HandleApiCallENS0_16BuiltinArgumentsEPNS0_7IsolateE :? Builtins_CEntry_Return1_DontSaveFPRegs_ArgvOnStack_BuiltinExit :?

minggo commented 2 years ago

You can have a try:

xjtulk commented 2 years ago

Ok, i will first try the second way on next application release to see if problems solved, thanks.

minggo commented 2 years ago

You are welcome. So you can not reproduce it?

xjtulk commented 2 years ago

I can only reproduce the first crash in auto test offline by far.

minggo commented 1 year ago

Ok, i will first try the second way on next application release to see if problems solved, thanks.

@xjtulk Any progress?

xjtulk commented 1 year ago

Sorry for the late reply, I disable multi-thread in the newest version and it seems most of the crash disappear, only few left, and the crash rate decrease a lot, thanks very much for your help.The left crash looks like below.

_ZN2cc3gfx25GLES3PrimaryCommandBuffer4drawERKNS0_8DrawInfoE /Applications/CocosCreator/Creator/3.5.2/CocosCreator.app/Contents/Resources/resources/3d/engine/native/cocos/renderer/gfx-gles3/GLES3PrimaryCommandBuffer.cpp:93 _ZN2cc3gfx13CommandBuffer4drawEPNS0_14InputAssemblerE /Applications/CocosCreator/Creator/3.5.2/CocosCreator.app/Contents/Resources/resources/3d/engine/native/cocos/renderer/gfx-base/GFXCommandBuffer.h:157 operator() /Applications/CocosCreator/Creator/3.5.2/CocosCreator.app/Contents/Resources/resources/3d/engine/native/cocos/renderer/pipeline/forward/ForwardStage.cpp:231 _ZN2cc10framegraph10FrameGraph7executeEv /Applications/CocosCreator/Creator/3.5.2/CocosCreator.app/Contents/Resources/resources/3d/engine/native/cocos/renderer/frame-graph/DevicePass.cpp:123 _ZN2cc8pipeline15ForwardPipeline6renderERKNSt6__ndk16vectorIPNS_5scene6CameraENS2_9allocatorIS6_EEEE /Applications/CocosCreator/Creator/3.5.2/CocosCreator.app/Contents/Resources/resources/3d/engine/native/cocos/renderer/pipeline/forward/ForwardPipeline.cpp:110 _ZL33js_pipeline_RenderPipeline_renderRN2se5StateE /Applications/CocosCreator/Creator/3.5.2/CocosCreator.app/Contents/Resources/resources/3d/engine/native/cocos/bindings/auto/jsb_pipeline_auto.cpp:1231

minggo commented 1 year ago

@xjtulk thanks for your feedback. We fixed some crashed caused by multi-thread and others in v3.6. So i keep this issue open. And if you upgrade your game to v3.6, please let me know if it has effect. Thanks.

xjtulk commented 1 year ago

Ok, it may takes us some time to upgrade to v3.6.I will notify you when we get it done.

minggo commented 1 year ago

Thanks.

minggo commented 1 year ago

@xjtulk have you upgrade to v3.6?

minggo commented 1 year ago

Close this issue as not response.