본문 바로가기

관리 메뉴

Unity Crash by 'DynamicHeapAllocator::Allocate', 'LoadSceneOperation::IntegrateTimeSliced' from '/system/lib/arm/nb/libtcb.so' 본문

프로그래밍/ㄴ이슈

Unity Crash by 'DynamicHeapAllocator::Allocate', 'LoadSceneOperation::IntegrateTimeSliced' from '/system/lib/arm/nb/libtcb.so'

최갓 2022. 12. 19. 19:19
반응형

Unity version을 2021.3.12f로 변경 후 특정 상황에서 유저가 게임을 오래 플레이 할 시 다음의 에러가 발생하면서 게임이 크래시나는 문제가 지속적으로 보고되었다

(firebase crashlytics를 통해 추적)

 

2022-12-06 16:07:10.469 16688 16764 Error CRASH *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
2022-12-06 16:07:10.469 16688 16764 Error CRASH Version '2021.3.12f1 (8af3c3e441b1)', Build type 'Development', Scripting Backend 'il2cpp', CPU 'armeabi-v7a'
2022-12-06 16:07:10.470 16688 16764 Error CRASH Build fingerprint: 'google/android_x86/x86:7.1.2/N2G48C/N975FXXU1ASGO:user/release-keys'
2022-12-06 16:07:10.470 16688 16764 Error CRASH Revision: '0'
2022-12-06 16:07:10.472 16688 16764 Error CRASH ABI: 'arm'
2022-12-06 16:07:10.473 16688 16764 Error CRASH Timestamp: 2022-12-06 16:07:10+0900
2022-12-06 16:07:10.473 16688 16764 Error CRASH pid: 16688, tid: 16764, name: UnityMain  >>> com.idle.game <<<
2022-12-06 16:07:10.474 16688 16764 Error CRASH uid: 10054
2022-12-06 16:07:10.475 16688 16764 Error CRASH signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x0
2022-12-06 16:07:10.475 16688 16764 Error CRASH Cause: null pointer dereference
2022-12-06 16:07:10.479 16688 16764 Error CRASH     r0  a8546600  r1  00ffffe9  r2  00000001  r3  00ffffdc
2022-12-06 16:07:10.479 16688 16764 Error CRASH     r4  00000000  r5  00000000  r6  0035cbd0  r7  00000000
2022-12-06 16:07:10.484 16688 16764 Error CRASH     r8  00000020  r9  00360000  r10 c6db1008  r11 05c7aea0
2022-12-06 16:07:10.485 16688 16764 Error CRASH     ip  0540ac45  sp  a61a3900  lr  042eca31  pc  0540ac8b
2022-12-06 16:07:10.489 16688 16764 Error CRASH 
2022-12-06 16:07:10.489 16688 16764 Error CRASH backtrace:
2022-12-06 16:07:10.489 16688 16764 Error CRASH       #00 pc 0140ac8b  /data/app/com.idle.game-1/lib/arm/libunity.so (tlsf_add_pool+70) (BuildId: 5fde9eccb4e2688a8ef6f01661585cc365d5aafb)
2022-12-06 16:07:10.489 16688 16764 Error CRASH       #01 pc 002eca2d  /data/app/com.idle.game-1/lib/arm/libunity.so (DynamicHeapAllocator::Allocate(unsigned int, int)+332) (BuildId: 5fde9eccb4e2688a8ef6f01661585cc365d5aafb)
2022-12-06 16:07:10.490 16688 16764 Error CRASH       #02 pc 002ef665  /data/app/com.idle.game-1/lib/arm/libunity.so (MemoryManager::Allocate(unsigned int, unsigned int, MemLabelId const&, AllocateOptions, char const*, int)+164) (BuildId: 5fde9eccb4e2688a8ef6f01661585cc365d5aafb)
2022-12-06 16:07:10.490 16688 16764 Error CRASH       #03 pc 002eba61  /data/app/com.idle.game-1/lib/arm/libunity.so (malloc_internal(unsigned int, unsigned int, MemLabelId const&, AllocateOptions, char const*, int)+40) (BuildId: 5fde9eccb4e2688a8ef6f01661585cc365d5aafb)
2022-12-06 16:07:10.490 16688 16764 Error CRASH       #04 pc 00ede3cc  /data/app/com.idle.game-1/lib/arm/libunity.so (VertexData::VertexData(MemLabelId const&, VertexData const&, ShaderChannelMask)+300) (BuildId: 5fde9eccb4e2688a8ef6f01661585cc365d5aafb)
2022-12-06 16:07:10.490 16688 16764 Error CRASH       #05 pc 00ead320  /data/app/com.idle.game-1/lib/arm/libunity.so (SharedMeshData::SharedMeshData(SharedMeshData const&)+72) (BuildId: 5fde9eccb4e2688a8ef6f01661585cc365d5aafb)
2022-12-06 16:07:10.490 16688 16764 Error CRASH       #06 pc 013f2f54  /data/app/com.idle.game-1/lib/arm/libunity.so (Mesh::UnshareMeshData()+116) (BuildId: 5fde9eccb4e2688a8ef6f01661585cc365d5aafb)
2022-12-06 16:07:10.491 16688 16764 Error CRASH       #07 pc 013fc7d0  /data/app/com.idle.game-1/lib/arm/libunity.so (Mesh::UploadMeshData(bool)+84) (BuildId: 5fde9eccb4e2688a8ef6f01661585cc365d5aafb)
2022-12-06 16:07:10.491 16688 16764 Error CRASH       #08 pc 013fc9b8  /data/app/com.idle.game-1/lib/arm/libunity.so (Mesh::AwakeFromLoad(AwakeFromLoadMode)+104) (BuildId: 5fde9eccb4e2688a8ef6f01661585cc365d5aafb)
2022-12-06 16:07:10.491 16688 16764 Error CRASH       #09 pc 00957e25  /data/app/com.idle.game-1/lib/arm/libunity.so (AwakeFromLoadQueue::PersistentManagerAwakeSingleObject(Object&, AwakeFromLoadMode)+32) (BuildId: 5fde9eccb4e2688a8ef6f01661585cc365d5aafb)
2022-12-06 16:07:10.491 16688 16764 Error CRASH       #10 pc 0095a259  /data/app/com.idle.game-1/lib/arm/libunity.so (PersistentManager::IntegrateObjectAndUnlockIntegrationMutexInternal(int)+24) (BuildId: 5fde9eccb4e2688a8ef6f01661585cc365d5aafb)
2022-12-06 16:07:10.492 16688 16764 Error CRASH       #11 pc 00625569  /data/app/com.idle.game-1/lib/arm/libunity.so (TimeSliceAwakeFromLoadQueue::IntegrateTimeSliced(int)+320) (BuildId: 5fde9eccb4e2688a8ef6f01661585cc365d5aafb)
2022-12-06 16:07:10.492 16688 16764 Error CRASH       #12 pc 006261ab  /data/app/com.idle.game-1/lib/arm/libunity.so (LoadSceneOperation::IntegrateTimeSliced(int)+6) (BuildId: 5fde9eccb4e2688a8ef6f01661585cc365d5aafb)
2022-12-06 16:07:10.492 16688 16764 Error CRASH       #13 pc 00627111  /data/app/com.idle.game-1/lib/arm/libunity.so (PreloadManager::UpdatePreloadingSingleStep(PreloadManager::UpdatePreloadingFlags, int)+80) (BuildId: 5fde9eccb4e2688a8ef6f01661585cc365d5aafb)
2022-12-06 16:07:10.493 16688 16764 Error CRASH       #14 pc 0062799d  /data/app/com.idle.game-1/lib/arm/libunity.so (PreloadManager::UpdatePreloading()+180) (BuildId: 5fde9eccb4e2688a8ef6f01661585cc365d5aafb)
2022-12-06 16:07:10.493 16688 16764 Error CRASH       #15 pc 006005b5  /data/app/com.idle.game-1/lib/arm/libunity.so (InitPlayerLoopCallbacks()::EarlyUpdateUpdatePreloadingRegistrator::Forward()+40) (BuildId: 5fde9eccb4e2688a8ef6f01661585cc365d5aafb)
2022-12-06 16:07:10.494 16688 16764 Error CRASH       #16 pc 00601851  /data/app/com.idle.game-1/lib/arm/libunity.so (ExecutePlayerLoop(NativePlayerLoopSystem*)+66) (BuildId: 5fde9eccb4e2688a8ef6f01661585cc365d5aafb)
2022-12-06 16:07:10.494 16688 16764 Error CRASH       #17 pc 00601891  /data/app/com.idle.game-1/lib/arm/libunity.so (ExecutePlayerLoop(NativePlayerLoopSystem*)+130) (BuildId: 5fde9eccb4e2688a8ef6f01661585cc365d5aafb)
2022-12-06 16:07:10.495 16688 16764 Error CRASH       #18 pc 00601a51  /data/app/com.idle.game-1/lib/arm/libunity.so (PlayerLoop()+224) (BuildId: 5fde9eccb4e2688a8ef6f01661585cc365d5aafb)
2022-12-06 16:07:10.495 16688 16764 Error CRASH       #19 pc 009996c9  /data/app/com.idle.game-1/lib/arm/libunity.so (UnityPlayerLoop()+576) (BuildId: 5fde9eccb4e2688a8ef6f01661585cc365d5aafb)
2022-12-06 16:07:10.496 16688 16764 Error CRASH       #20 pc 009c207d  /data/app/com.idle.game-1/lib/arm/libunity.so (nativeRender(_JNIEnv*, _jobject*)+40) (BuildId: 5fde9eccb4e2688a8ef6f01661585cc365d5aafb)
2022-12-06 16:07:10.496 16688 16764 Error CRASH       #21 pc 0007341e  /system/lib/arm/nb/libtcb.so
2022-12-06 16:07:11.424 16688 16764 Error CRASH Tombstone written to: /storage/emulated/0/Android/data/com.idle.pseudo3d.hero/files/tombstone_00

주로 반복적인 게임 콘텐츠를 플레이하며 유저가 게임을 가만히 뒀을 때 발생했다.

 

이 중 주목해야 할 구문은 'LoadSceneOperation::IntegrateTimeSliced'해당 구문이다.

 

콘텐츠의 반복 플레이를 통해 지속적으로 장면의 SceneManager.UnloadSceneAsync와 SceneManager.LoadSceneAsync를 불러준다.

 

이러다 할당된 메모리, 객체, 텍스쳐, 오브젝트 등이 제대로 정리되지 않은 체로 다시 호출되거나 등의 이유로 crash가 발생하는 것이었다.

 

해결 : SceneManager를 통해 장면 변환을 자주 반복하지 않고, 캐싱해서 사용하거나, 변경하고자 하는 scene의 이름이 같은 경우 해당 scene을 unload후 다시 load하지 않고 초기화만 시키는 형태로 코드를 개선해 해결함.

 

평균 2시간~4시간이면 크래시가 나는 환경에서 테스트시, 3일 내내 크래시가 발생하지 않았음

반응형
Comments