focus-creative-games / hybridclr

HybridCLR是一个特性完整、零成本、高性能、低内存的Unity全平台原生c#热更新解决方案。 HybridCLR is a fully featured, zero-cost, high-performance, low-memory solution for Unity's all-platform native c# hotupdate.
https://code-philosophy.com/
MIT License
6.6k stars 670 forks source link

Incremental GC下 多维数组触发GC崩溃 #124

Closed bashen1291 closed 9 months ago

bashen1291 commented 9 months ago

Describe the bug | 描述问题 在动更Mono中创建并赋值多维数组,当触发某些GC操作时,会出现AssetGarbageCol崩溃。 使用场景AB来加载场景可以稳定复现.

Enviroment | 环境

To Reproduce | 复制步骤

Please provide a reproduction project. Please try to reproduce this bug on the https://github.com/focus-creative-games/hybridclr_trial project. | 提供复现工程,请尽量在 https://github.com/focus-creative-games/hybridclr_trial 项目上复现这个bug。 附件已提供复现工程

Steps to reproduce the behavior :

  1. 创建一个Mono脚本, 增加一个多维数组属性。
  2. 在Start中为多维数组属性初始化并完成赋值(如果不赋值貌似不出现崩溃)
  3. 将该Mono挂在一个Scene上。
  4. 将Scene打包成AB
  5. 使用其他动更脚本加载SceneAB, 然后加载Scene.

Expected behavior | 期望的结果 正常

Screenshots | 截图或者日志 2024/02/28 16:19:07.555 17205 17205 Fatal DEBUG pid: 17139, tid: 17163, name: AssetGarbageCol >>> com.Dev.HybridCLRTrial <<< 2024/02/28 16:19:07.555 17205 17205 Fatal DEBUG uid: 10202 2024/02/28 16:19:07.555 17205 17205 Fatal DEBUG signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x4 2024/02/28 16:19:07.555 17205 17205 Fatal DEBUG Cause: null pointer dereference 2024/02/28 16:19:07.555 17205 17205 Fatal DEBUG r0 00000004 r1 00000001 r2 b6df2050 r3 fffffffc 2024/02/28 16:19:07.555 17205 17205 Fatal DEBUG r4 c1d44360 r5 baad7bf0 r6 c1d407f0 r7 c5d19978 2024/02/28 16:19:07.555 17205 17205 Fatal DEBUG r8 91545347 r9 c865dfc4 r10 c5d1a490 r11 c0d3c0c8 2024/02/28 16:19:07.555 17205 17205 Fatal DEBUG ip b6df204c sp c0d3c0ac lr c6540af0 pc c5e37400 2024/02/28 16:19:07.610 17205 17205 Fatal DEBUG 2024/02/28 16:19:07.610 17205 17205 Fatal DEBUG backtrace: 2024/02/28 16:19:07.610 17205 17205 Fatal DEBUG #00 pc 00119400 /data/app/com.Dev.HybridCLRTrial-2T0MdoyMYzJjDwLJhsdfig==/lib/arm/libil2cpp.so (il2cpp::vm::ClassInlines::HasParentUnsafe(Il2CppClass const, Il2CppClass const)+68) (BuildId: 4fe762615e62c93a995dff7782a503a1388d8130) 2024/02/28 16:19:07.610 17205 17205 Fatal DEBUG #01 pc 00822aec /data/app/com.Dev.HybridCLRTrial-2T0MdoyMYzJjDwLJhsdfig==/lib/arm/libil2cpp.so (il2cpp::vm::LivenessState::ShouldProcessValue(Il2CppObject, Il2CppClass)+64) (BuildId: 4fe762615e62c93a995dff7782a503a1388d8130) 2024/02/28 16:19:07.610 17205 17205 Fatal DEBUG #02 pc 00823288 /data/app/com.Dev.HybridCLRTrial-2T0MdoyMYzJjDwLJhsdfig==/lib/arm/libil2cpp.so (il2cpp::vm::LivenessState::AddProcessObject(Il2CppObject, il2cpp::vm::LivenessState)+140) (BuildId: 4fe762615e62c93a995dff7782a503a1388d8130) 2024/02/28 16:19:07.610 17205 17205 Fatal DEBUG #03 pc 00822e30 /data/app/com.Dev.HybridCLRTrial-2T0MdoyMYzJjDwLJhsdfig==/lib/arm/libil2cpp.so (il2cpp::vm::LivenessState::TraverseArray(Il2CppArray, il2cpp::vm::LivenessState)+548) (BuildId: 4fe762615e62c93a995dff7782a503a1388d8130) 2024/02/28 16:19:07.611 17205 17205 Fatal DEBUG #04 pc 00822988 /data/app/com.Dev.HybridCLRTrial-2T0MdoyMYzJjDwLJhsdfig==/lib/arm/libil2cpp.so (il2cpp::vm::LivenessState::TraverseGenericObject(Il2CppObject, il2cpp::vm::LivenessState)+112) (BuildId: 4fe762615e62c93a995dff7782a503a1388d8130) 2024/02/28 16:19:07.611 17205 17205 Fatal DEBUG #05 pc 008228f4 /data/app/com.Dev.HybridCLRTrial-2T0MdoyMYzJjDwLJhsdfig==/lib/arm/libil2cpp.so (il2cpp::vm::LivenessState::TraverseObjects()+96) (BuildId: 4fe762615e62c93a995dff7782a503a1388d8130) 2024/02/28 16:19:07.611 17205 17205 Fatal DEBUG #06 pc 00823564 /data/app/com.Dev.HybridCLRTrial-2T0MdoyMYzJjDwLJhsdfig==/lib/arm/libil2cpp.so (il2cpp::vm::Liveness::FromRoot(Il2CppObject, void)+60) (BuildId: 4fe762615e62c93a995dff7782a503a1388d8130) 2024/02/28 16:19:07.611 17205 17205 Fatal DEBUG #07 pc 005f98a0 /data/app/com.Dev.HybridCLRTrial-2T0MdoyMYzJjDwLJhsdfig==/lib/arm/libil2cpp.so (il2cpp_unity_liveness_calculation_from_root+28) (BuildId: 4fe762615e62c93a995dff7782a503a1388d8130) 2024/02/28 16:19:07.611 17205 17205 Fatal DEBUG #08 pc 00116c0f /data/app/com.Dev.HybridCLRTrial-2T0MdoyMYzJjDwLJhsdfig==/lib/arm/libunity.so (BuildId: b36c0bfe9c2ecd51fdff619301bf27efb62523f7) 2024/02/28 16:19:07.611 17205 17205 Fatal DEBUG #09 pc 001168cd /data/app/com.Dev.HybridCLRTrial-2T0MdoyMYzJjDwLJhsdfig==/lib/arm/libunity.so (BuildId: b36c0bfe9c2ecd51fdff619301bf27efb62523f7) 2024/02/28 16:19:07.611 17205 17205 Fatal DEBUG #10 pc 00115b93 /data/app/com.Dev.HybridCLRTrial-2T0MdoyMYzJjDwLJhsdfig==/lib/arm/libunity.so (BuildId: b36c0bfe9c2ecd51fdff619301bf27efb62523f7) 2024/02/28 16:19:07.611 17205 17205 Fatal DEBUG #11 pc 0011a331 /data/app/com.Dev.HybridCLRTrial-2T0MdoyMYzJjDwLJhsdfig==/lib/arm/libunity.so (BuildId: b36c0bfe9c2ecd51fdff619301bf27efb62523f7) 2024/02/28 16:19:07.611 17205 17205 Fatal DEBUG #12 pc 0017ba77 /data/app/com.Dev.HybridCLRTrial-2T0MdoyMYzJjDwLJhsdfig==/lib/arm/libunity.so (BuildId: b36c0bfe9c2ecd51fdff619301bf27efb62523f7) 2024/02/28 16:19:07.611 17205 17205 Fatal DEBUG #13 pc 000a6293 /apex/com.android.runtime/lib/bionic/libc.so (__pthread_start(void*)+20) (BuildId: af31ec96b35fedca378e07659b30896c) 2024/02/28 16:19:07.611 17205 17205 Fatal DEBUG #14 pc 00060803 /apex/com.android.runtime/lib/bionic/libc.so (__start_thread+30) (BuildId: af31ec96b35fedca378e07659b30896c)

Additional context | 补充信息 加载场景是目前测试到的最稳定的复现方式。不排除有其他操作可以触发。

hybridclr_trial-crash.zip

pirunxi commented 9 months ago

我们会尽快解决这个问题

pirunxi commented 9 months ago

此问题我们已经定位并且修复。下个版本会包含这个修复。非常感谢。

Bian-Sh commented 8 months ago

堪称神速