linux - LINUX - 我的 Unity 游戏的构建在几个小时后崩溃 - 收到未处理的 NULL 异常
问题描述
问题描述:
构建崩溃并在几个小时后自行关闭(通常在 4 到 12 小时之间),并在日志中打印此消息:
Receiving unhandled NULL exception
#0 0x00000000ff382c in std::vector<std::vector<std::pair<int, int>, std::allocator<std::pair<int, int> > >, std::allocator<std::vector<std::pair<int, int>, std::allocator<std::pair<int, int> > > > >::~vector()
#1 0x0000000102c983 in std::vector<std::vector<std::pair<int, int>, std::allocator<std::pair<int, int> > >, std::allocator<std::vector<std::pair<int, int>, std::allocator<std::pair<int, int> > > > >::~vector()
#2 0x0000000102d9c5 in std::vector<std::vector<std::pair<int, int>, std::allocator<std::pair<int, int> > >, std::allocator<std::vector<std::pair<int, int>, std::allocator<std::pair<int, int> > > > >::~vector()
#3 0x00000000c07080 in operator new[](unsigned long, std::nothrow_t const&)
#4 0x00000000c0719f in operator new[](unsigned long, std::nothrow_t const&)
#5 0x00000000c07522 in operator new[](unsigned long, std::nothrow_t const&)
#6 0x00000000c07798 in operator new[](unsigned long, std::nothrow_t const&)
#7 0x00000000c078db in operator new[](unsigned long, std::nothrow_t const&)
#8 0x00000000cb8d90 in operator new[](unsigned long, std::nothrow_t const&)
#9 0x007f29dc9ff182 in start_thread
#10 0x007f29dc926b1f in clone
技术规格:
- Unity:2018.4.28 LTS(在 Windows 上运行)
- 操作系统: UDOO 团队为 UDOO Bolt 优化的 Ubuntu 19.04 LTS ( https://www.udoo.org/docs-bolt/Operating_Systems/Linux/index.html )
- 硬件:UDOO Bolt v8(https://shop.udoo.org/udoo-bolt-v8.html和https://www.udoo.org/docs-bolt/Introduction/Introduction.html)
已完成测试(未修复错误):
- 为了分离我的线程的日志(因为我有几个线程),所以每个线程都在不同的文件上打印调试,而不是使用 Player.log,因为它被主线程使用。
- 创建没有线程的构建。
- 保持硬件温度非常低,大约 45°,避免 CPU 和 GPU 的高温。
- 从 BIOS 禁用 AMD 虚拟化。
- 在 Player Settings -> Other 中启用“Disable HW Statistics”复选框,因为我发现这可能导致错误“Curl error 6: Could not resolve host: cdp.cloud.unity3d.com”,其堆栈跟踪与崩溃之一非常相似(查看堆栈跟踪,我在 Player Settings -> Other -> Logging 中将其设置为 Full):
卷曲错误6:无法解析主机:cdp.cloud.unity3d.com
#0 std::vector<std::vector<std::pair<int, int>, std::allocator<std::pair<int, int> > >, std::allocator<std::vector<std::pair<int, int>, std::allocator<std::pair<int, int> > > > >::~vector()
#1 ???
#2 std::vector<std::vector<std::pair<int, int>, std::allocator<std::pair<int, int> > >, std::allocator<std::vector<std::pair<int, int>, std::allocator<std::pair<int, int> > > > >::~vector()
#3 std::vector<std::vector<std::pair<int, int>, std::allocator<std::pair<int, int> > >, std::allocator<std::vector<std::pair<int, int>, std::allocator<std::pair<int, int> > > > >::~vector()
#4 std::vector<std::vector<std::pair<int, int>, std::allocator<std::pair<int, int> > >, std::allocator<std::vector<std::pair<int, int>, std::allocator<std::pair<int, int> > > > >::~vector()
#5 operator new[](unsigned long, std::nothrow_t const&)
#6 operator new[](unsigned long, std::nothrow_t const&)
#7 operator new[](unsigned long, std::nothrow_t const&)
#8 operator new[](unsigned long, std::nothrow_t const&)
#9 operator new[](unsigned long, std::nothrow_t const&)
#10 operator new[](unsigned long, std::nothrow_t const&)
#11 start_thread
#12 clone
从之前的测试中收集的信息:
- 有时崩溃后只有“接收未处理的 NULL 异常”错误,有时还有完整的堆栈跟踪。
- 有时,“接收未处理的 NULL 异常”错误会通过其他打印与堆栈跟踪分开。
- 在 Unity 中启用 Full Log,正是在 Player Settings -> Other -> Logging 中,更新中的打印(使用 debug.log)会生成此堆栈跟踪(这与我们的异常非常相似,所以我猜测“operator new [](unsigned long, std::nothrow_t const&)” 和 Vector 是 Debug.Log 的一部分,它们与我的问题无关):
调试日志堆栈跟踪
DebugLog from Update!
#0 std::vector<std::vector<std::pair<int, int>, std::allocator<std::pair<int, int> > >, std::allocator<std::vector<std::pair<int, int>, std::allocator<std::pair<int, int> > > > >::~vector()
#1 std::vector<std::vector<std::pair<int, int>, std::allocator<std::pair<int, int> > >, std::allocator<std::vector<std::pair<int, int>, std::allocator<std::pair<int, int> > > > >::~vector()
#2 (Mono JIT Code) (wrapper managed-to-native) UnityEngine.DebugLogHandler:Internal_Log (UnityEngine.LogType,string,UnityEngine.Object)
#3 mono_print_method_from_ip
#4 mono_perfcounter_foreach
#5 mono_runtime_invoke
#6 operator new[](unsigned long, std::nothrow_t const&)
#7 operator new[](unsigned long, std::nothrow_t const&)
#8 operator new[](unsigned long, std::nothrow_t const&)
#9 operator new[](unsigned long, std::nothrow_t const&)
#10 operator new[](unsigned long, std::nothrow_t const&)
#11 operator new[](unsigned long, std::nothrow_t const&)
#12 operator new[](unsigned long, std::nothrow_t const&)
#13 ???
#14 __libc_start_main
#15 ???
- 只有一次堆栈跟踪不同:
“不同的接收未处理的 NULL 异常”
Receiving unhandled NULL exception
#0 0x007f1056492bf4 in nouveau_drm_screen_create
#1 0x007f1056495aa0 in nouveau_drm_screen_create
#2 0x007f10561a878f in nouveau_drm_screen_create
#3 0x007f1056235c84 in nouveau_drm_screen_create
#4 0x007f1056235f87 in nouveau_drm_screen_create
#5 0x000000010dcf2a in std::vector<std::vector<std::pair<int, int>, std::allocator<std::pair<int, int> > >, std::allocator<std::vector<std::pair<int, int>, std::allocator<std::pair<int, int> > > > >::~vector()
#6 0x000000010f1169 in std::vector<std::vector<std::pair<int, int>, std::allocator<std::pair<int, int> > >, std::allocator<std::vector<std::pair<int, int>, std::allocator<std::pair<int, int> > > > >::~vector()
#7 0x00000000b01116 in operator new[](unsigned long, std::nothrow_t const&)
#8 0x000000010ef244 in std::vector<std::vector<std::pair<int, int>, std::allocator<std::pair<int, int> > >, std::allocator<std::vector<std::pair<int, int>, std::allocator<std::pair<int, int> > > > >::~vector()
#9 0x00000000924e9b in std::pow(float, float)
#10 0x000000009209e2 in std::pow(float, float)
#11 0x00000000920b19 in std::pow(float, float)
#12 0x00000000cb8d90 in operator new[](unsigned long, std::nothrow_t const&)
#13 0x007f105b6ed182 in start_thread
#14 0x007f105b614b1f in clone
- 我注意到这些东西拦截了游戏接收到的信号:每 5 秒(大约),收到 7 个信号 SIGPWR,然后是 7 个信号 SIGXCPU。当游戏崩溃时,已经收到信号SIGSEGV、SIGABRT,后面跟着很多SIGSTOP,以SIGABRT和SIGPIPE结束。这是信号日志的最后一部分。列使用此顺序:“Epoch”、“Time of Signal”、“Name”、“PID”、“Signal”、“Signaling Process Name”
处理信号日志
1601585247770866 Thu Oct 1 22:47:27 2020 CEST MyGame.x86_ 30851 SIGPWR MyGame.x86_
1601585247770920 Thu Oct 1 22:47:27 2020 CEST MyGame.x86_ 30851 SIGPWR MyGame.x86_
1601585247770934 Thu Oct 1 22:47:27 2020 CEST MyGame.x86_ 30851 SIGPWR MyGame.x86_
1601585247771012 Thu Oct 1 22:47:27 2020 CEST MyGame.x86_ 30851 SIGPWR MyGame.x86_
1601585247771033 Thu Oct 1 22:47:27 2020 CEST MyGame.x86_ 30851 SIGPWR MyGame.x86_
1601585247771101 Thu Oct 1 22:47:27 2020 CEST MyGame.x86_ 30851 SIGPWR MyGame.x86_
1601585247771112 Thu Oct 1 22:47:27 2020 CEST MyGame.x86_ 30851 SIGPWR MyGame.x86_
1601585247790047 Thu Oct 1 22:47:27 2020 CEST MyGame.x86_ 30851 SIGXCPU MyGame.x86_
1601585247790085 Thu Oct 1 22:47:27 2020 CEST MyGame.x86_ 30851 SIGXCPU MyGame.x86_
1601585247790098 Thu Oct 1 22:47:27 2020 CEST MyGame.x86_ 30851 SIGXCPU MyGame.x86_
1601585247790155 Thu Oct 1 22:47:27 2020 CEST MyGame.x86_ 30851 SIGXCPU MyGame.x86_
1601585247790171 Thu Oct 1 22:47:27 2020 CEST MyGame.x86_ 30851 SIGXCPU MyGame.x86_
1601585247790234 Thu Oct 1 22:47:27 2020 CEST MyGame.x86_ 30851 SIGXCPU MyGame.x86_
1601585247790245 Thu Oct 1 22:47:27 2020 CEST MyGame.x86_ 30851 SIGXCPU MyGame.x86_
1601585252704451 Thu Oct 1 22:47:32 2020 CEST MyGame.x86_ 30851 SIGPWR MyGame.x86_
1601585252704506 Thu Oct 1 22:47:32 2020 CEST MyGame.x86_ 30851 SIGPWR MyGame.x86_
1601585252704570 Thu Oct 1 22:47:32 2020 CEST MyGame.x86_ 30851 SIGPWR MyGame.x86_
1601585252704591 Thu Oct 1 22:47:32 2020 CEST MyGame.x86_ 30851 SIGPWR MyGame.x86_
1601585252704653 Thu Oct 1 22:47:32 2020 CEST MyGame.x86_ 30851 SIGPWR MyGame.x86_
1601585252704673 Thu Oct 1 22:47:32 2020 CEST MyGame.x86_ 30851 SIGPWR MyGame.x86_
1601585252704685 Thu Oct 1 22:47:32 2020 CEST MyGame.x86_ 30851 SIGPWR MyGame.x86_
1601585252723584 Thu Oct 1 22:47:32 2020 CEST MyGame.x86_ 30851 SIGXCPU MyGame.x86_
1601585252723644 Thu Oct 1 22:47:32 2020 CEST MyGame.x86_ 30851 SIGXCPU MyGame.x86_
1601585252723698 Thu Oct 1 22:47:32 2020 CEST MyGame.x86_ 30851 SIGXCPU MyGame.x86_
1601585252723716 Thu Oct 1 22:47:32 2020 CEST MyGame.x86_ 30851 SIGXCPU MyGame.x86_
1601585252723799 Thu Oct 1 22:47:32 2020 CEST MyGame.x86_ 30851 SIGXCPU MyGame.x86_
1601585252723819 Thu Oct 1 22:47:32 2020 CEST MyGame.x86_ 30851 SIGXCPU MyGame.x86_
1601585252723829 Thu Oct 1 22:47:32 2020 CEST MyGame.x86_ 30851 SIGXCPU MyGame.x86_
1601585253349839 Thu Oct 1 22:47:33 2020 CEST MyGame.x86_ 30851 SIGSEGV MyGame.x86_
1601585253360946 Thu Oct 1 22:47:33 2020 CEST MyGame.x86_ 30851 SIGABRT MyGame.x86_
1601585253471368 Thu Oct 1 22:47:33 2020 CEST MyGame.x86_ 30851 SIGSTOP gdb
1601585253471658 Thu Oct 1 22:47:33 2020 CEST MyGame:cs0 30851 SIGSTOP gdb
1601585253471690 Thu Oct 1 22:47:33 2020 CEST MyGame:sh0 30851 SIGSTOP gdb
1601585253471704 Thu Oct 1 22:47:33 2020 CEST MyGame:sh1 30851 SIGSTOP gdb
1601585253471731 Thu Oct 1 22:47:33 2020 CEST MyGame:sh2 30851 SIGSTOP gdb
1601585253471752 Thu Oct 1 22:47:33 2020 CEST MyGame:sh3 30851 SIGSTOP gdb
1601585253471763 Thu Oct 1 22:47:33 2020 CEST MyGame:sh4 30851 SIGSTOP gdb
1601585253471774 Thu Oct 1 22:47:33 2020 CEST MyGame:sh5 30851 SIGSTOP gdb
1601585253471859 Thu Oct 1 22:47:33 2020 CEST MyGame.x86_ 30851 SIGSTOP gdb
1601585253471890 Thu Oct 1 22:47:33 2020 CEST MyGame.x86_ 30851 SIGSTOP gdb
1601585253471904 Thu Oct 1 22:47:33 2020 CEST MyGame.x86_ 30851 SIGSTOP gdb
1601585253471917 Thu Oct 1 22:47:33 2020 CEST MyGame.x86_ 30851 SIGSTOP gdb
1601585253471937 Thu Oct 1 22:47:33 2020 CEST MyGame.x86_ 30851 SIGSTOP gdb
1601585253471953 Thu Oct 1 22:47:33 2020 CEST MyGame.x86_ 30851 SIGSTOP gdb
1601585253471968 Thu Oct 1 22:47:33 2020 CEST MyGame.x86_ 30851 SIGSTOP gdb
1601585253471980 Thu Oct 1 22:47:33 2020 CEST MyGame.x86_ 30851 SIGSTOP gdb
1601585253471990 Thu Oct 1 22:47:33 2020 CEST MyGame.x86_ 30851 SIGSTOP gdb
1601585253472015 Thu Oct 1 22:47:33 2020 CEST MyGame.x86_ 30851 SIGSTOP gdb
1601585253472027 Thu Oct 1 22:47:33 2020 CEST MyGame.x86_ 30851 SIGSTOP gdb
1601585253472043 Thu Oct 1 22:47:33 2020 CEST MyGame.x86_ 30851 SIGSTOP gdb
1601585253472059 Thu Oct 1 22:47:33 2020 CEST MyGame.x86_ 30851 SIGSTOP gdb
1601585253472074 Thu Oct 1 22:47:33 2020 CEST MyGame.x86_ 30851 SIGSTOP gdb
1601585253472084 Thu Oct 1 22:47:33 2020 CEST MyGame.x86_ 30851 SIGSTOP gdb
1601585253472103 Thu Oct 1 22:47:33 2020 CEST MyGame.x86_ 30851 SIGSTOP gdb
1601585253472121 Thu Oct 1 22:47:33 2020 CEST MyGame.x86_ 30851 SIGSTOP gdb
1601585253472136 Thu Oct 1 22:47:33 2020 CEST MyGame.x86_ 30851 SIGSTOP gdb
1601585253472150 Thu Oct 1 22:47:33 2020 CEST MyGame.x86_ 30851 SIGSTOP gdb
1601585253472165 Thu Oct 1 22:47:33 2020 CEST MyGame.x86_ 30851 SIGSTOP gdb
1601585253472176 Thu Oct 1 22:47:33 2020 CEST MyGame.x86_ 30851 SIGSTOP gdb
1601585253472194 Thu Oct 1 22:47:33 2020 CEST MyGame.x86_ 30851 SIGSTOP gdb
1601585253472208 Thu Oct 1 22:47:33 2020 CEST MyGame.x86_ 30851 SIGSTOP gdb
1601585253472223 Thu Oct 1 22:47:33 2020 CEST MyGame.x86_ 30851 SIGSTOP gdb
1601585253472246 Thu Oct 1 22:47:33 2020 CEST MyGame.x86_ 30851 SIGSTOP gdb
1601585253472275 Thu Oct 1 22:47:33 2020 CEST MyGame.x86_ 30851 SIGSTOP gdb
1601585253472291 Thu Oct 1 22:47:33 2020 CEST MyGame.x86_ 30851 SIGSTOP gdb
1601585253472316 Thu Oct 1 22:47:33 2020 CEST MyGame.x86_ 30851 SIGSTOP gdb
1601585253472333 Thu Oct 1 22:47:33 2020 CEST MyGame.x86_ 30851 SIGSTOP gdb
1601585253472348 Thu Oct 1 22:47:33 2020 CEST MyGame.x86_ 30851 SIGSTOP gdb
1601585253472363 Thu Oct 1 22:47:33 2020 CEST MyGame.x86_ 30851 SIGSTOP gdb
1601585253472391 Thu Oct 1 22:47:33 2020 CEST MyGame.x86_ 30851 SIGSTOP gdb
1601585253472408 Thu Oct 1 22:47:33 2020 CEST MyGame.x86_ 30851 SIGSTOP gdb
1601585253472418 Thu Oct 1 22:47:33 2020 CEST MyGame.x86_ 30851 SIGSTOP gdb
1601585253472435 Thu Oct 1 22:47:33 2020 CEST MyGame.x86_ 30851 SIGSTOP gdb
1601585253472451 Thu Oct 1 22:47:33 2020 CEST MyGame.x86_ 30851 SIGSTOP gdb
1601585253472482 Thu Oct 1 22:47:33 2020 CEST MyGame.x86_ 30851 SIGSTOP gdb
1601585253472593 Thu Oct 1 22:47:33 2020 CEST MyGame.x86_ 30851 SIGSTOP gdb
1601585254227807 Thu Oct 1 22:47:34 2020 CEST MyGame.x86_ 30851 SIGCHLD gdb
1601585254227927 Thu Oct 1 22:47:34 2020 CEST MyGame.x86_ 30851 SIGABRT MyGame.x86_
1601585254309322 Thu Oct 1 22:47:34 2020 CEST MyGame.x86_ 30851 SIGPIPE MyGame.x86_
1601585254309342 Thu Oct 1 22:47:34 2020 CEST MyGame.x86_ 30851 SIGPIPE MyGame.x86_
使用的资源:
我使用以下脚本来拦截信号,使用命令“sudo stap myscript.stp”运行它。
#! /usr/bin/env stap
probe signal.send {
if ((isinstr(pid_name, "MyGame"))) {
printf("%10d %-34s %-10s %5d %-7s %s\n",
gettimeofday_us(), tz_ctime(gettimeofday_s()),
pid_name, sig_pid, sig_name, execname());
}
}
probe begin {
printf("systemtap script started at: %s\n\n", tz_ctime(gettimeofday_s()));
printf("%50s%-18s\n", "", "Signaled Process");
printf("%-10s %-34s %-10s %5s %-7s %s\n",
"Epoch", "Time of Signal", "Name", "PID", "Signal", "Signaling Process Name");
printf("---------------------------------------------------------------");
printf("---------------------------------------------------------------");
printf("\n");
}
probe end {
printf("\n");
}
怀疑
- 坠机期间收到的信号是否是造成坠机的原因?或者他们是一个后果?
- “Curl 错误 6:无法解析主机:cdp.cloud.unity3d.com”可能是问题所在吗?
- 崩溃似乎是由分段错误引起的。我的游戏是否会产生这种分段错误?或者它可能是一个图书馆或其他什么东西?我怎么理解?
我正在尝试做的事情(但我目前陷入困境):
我想创建一个使用调试器分析它的转储。- 我想找到一种方法来捕获未处理的异常,从而更容易研究问题。
更新 x1:
我能够创建核心转储。你可以在这里找到完整的日志: https ://pastebin.com/1Bm70rNd
虽然异常的本机堆栈跟踪是:
/home/username0/MyGame_Game/Game/MyGame_Data/MonoBleedingEdge/x86_64/libmonobdwgc-2.0.so(+0xd5378) [0x7f644c157378]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x15540) [0x7f645dd08540]
/lib/x86_64-linux-gnu/libc.so.6(gsignal+0xcb) [0x7f645db463eb]
/lib/x86_64-linux-gnu/libc.so.6(abort+0x12b) [0x7f645db25899]
MyGame_Game/Game/MyGame.x86_64() [0xd341e6]
/home/username0/MyGame_Game/Game/MyGame_Data/MonoBleedingEdge/x86_64/libmonobdwgc-2.0.so(+0x14ea2e) [0x7f644c1d0a2e] /home/username0/MyGame_Game/Game/MyGame_Data/MonoBleedingEdge/x86_64/libmonobdwgc-2.0.so(+0x5be11) [0x7f644c0dde11]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x15540) [0x7f645dd08540]
MyGame_Game/Game/MyGame.x86_64() [0xb23e60]
MyGame_Game/Game/MyGame.x86_64() [0xff382c]
MyGame_Game/Game/MyGame.x86_64() [0x102c983]
MyGame_Game/Game/MyGame.x86_64() [0x102d9c5]
MyGame_Game/Game/MyGame.x86_64() [0xc07080]
MyGame_Game/Game/MyGame.x86_64() [0xc0719f]
MyGame_Game/Game/MyGame.x86_64() [0xc07522]
MyGame_Game/Game/MyGame.x86_64() [0xc07798]
MyGame_Game/Game/MyGame.x86_64() [0xc078db]
MyGame_Game/Game/MyGame.x86_64() [0xcb8d90]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x9669) [0x7f645dcfc669]
/lib/x86_64-linux-gnu/libc.so.6(clone+0x43) [0x7f645dc222b3]
在网上搜索有关此异常的信息,我发现它可能是 Mono 的错误和/或驱动程序兼容性问题。现在我将 Ubuntu 从 19.04 更新到 20.04 以尝试 amdgpu-pro 驱动程序(而不是 Ubuntu 中包含的 amdgpu),因为我找不到适用于 Ubuntu 19.04 的 amdgpu-pro 驱动程序。
解决方案
最后,我发现我的问题是粒子的 Trail 选项。当我在互联网上搜索时,我发现其他人说轨迹渲染器可能是问题,但我不知道我正在使用它,因为它在粒子内部(我有几个),所以我排除了这个原因。
我还检查了驱动程序兼容性问题,我更新到 Ubuntu 20.04 并安装了 amdgpu-pro 驱动程序,但它没有解决任何问题。
希望这会有所帮助。
推荐阅读
- javascript - Alpine.js +flatpickr Datetimepicker 不工作
- python - 在二维列表中查找最高平均值
- f# - 如何使用 F# 验证 RsaSha256 JWT 签名?
- swift - 此代码对于启用大标题是否正确?
- django - django request.user.is_authenticated 一段时间后返回 AnonymousUser
- ajax - Laravel Ajax 添加到购物车按钮
- python - 为什么这一直显示菜单?- python
- python - 绘制时间线突出显示 DataFrame 中存在的特定值
- google-cloud-platform - 无法连接到 google 实例“google-accounts:调用响应处理程序的错误异常”。
- python - SageMaker 模型中的自定义特征工程