LINUX - 我的 Unity 游戏构建在几个小时后崩溃了 - 收到未处理的 NULL 异常
LINUX - The build of my Unity game crashes after a few hours - Receiving unhandled NULL exception
问题描述:
构建在几个小时后(通常在 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 上)
- OS:Ubuntu UDOO 团队针对 UDOO Bolt 优化的 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 and https://www.udoo.org/docs-bolt/Introduction/Introduction.html)
已完成测试(未修复错误):
- 为了分离我的线程的日志(因为我有几个线程),所以每个线程在不同的文件上打印调试而不使用 Player.log 因为它被主线程使用。
- 创建没有线程的构建。
- 保持硬件温度非常低,大约 45° 避免 CPU 和 GPU 上的高温。
- 从 BI 禁用 AMD 虚拟化OS。
- 在播放器设置 -> 其他中启用“禁用硬件统计”复选框,因为我发现这可能是导致错误“Curl 错误 6:无法解析主机:cdp.cloud。unity3d.com",其堆栈跟踪与崩溃之一非常相似(为了查看堆栈跟踪,我在播放器设置 -> 其他 -> 日志记录中将其设置为完整):
Curl 错误 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 中启用完整日志,精确地在 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 的错误 and/or 驱动程序兼容性问题。现在我将 Ubuntu 从 19.04 更新到 20.04 以尝试使用 amdgpu-pro 驱动程序(而不是 Ubuntu 中包含的 amdgpu),因为我找不到 Ubuntu 的 amdgpu-pro 驱动程序19.04.
最后,我发现我的问题是粒子的Trail选项。
当我在互联网上搜索时,我发现其他人说轨迹渲染器可能是问题所在,但我不知道我在使用它,因为它在粒子内部(我有几个),所以我排除了这个原因。
我也检查了驱动兼容性问题,我更新到Ubuntu 20.04并且安装了amdgpu-pro驱动,但没有解决任何问题。
希望这会有所帮助。
问题描述:
构建在几个小时后(通常在 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 上)
- OS:Ubuntu UDOO 团队针对 UDOO Bolt 优化的 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 and https://www.udoo.org/docs-bolt/Introduction/Introduction.html)
已完成测试(未修复错误):
- 为了分离我的线程的日志(因为我有几个线程),所以每个线程在不同的文件上打印调试而不使用 Player.log 因为它被主线程使用。
- 创建没有线程的构建。
- 保持硬件温度非常低,大约 45° 避免 CPU 和 GPU 上的高温。
- 从 BI 禁用 AMD 虚拟化OS。
- 在播放器设置 -> 其他中启用“禁用硬件统计”复选框,因为我发现这可能是导致错误“Curl 错误 6:无法解析主机:cdp.cloud。unity3d.com",其堆栈跟踪与崩溃之一非常相似(为了查看堆栈跟踪,我在播放器设置 -> 其他 -> 日志记录中将其设置为完整):
Curl 错误 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 中启用完整日志,精确地在 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 的错误 and/or 驱动程序兼容性问题。现在我将 Ubuntu 从 19.04 更新到 20.04 以尝试使用 amdgpu-pro 驱动程序(而不是 Ubuntu 中包含的 amdgpu),因为我找不到 Ubuntu 的 amdgpu-pro 驱动程序19.04.
最后,我发现我的问题是粒子的Trail选项。 当我在互联网上搜索时,我发现其他人说轨迹渲染器可能是问题所在,但我不知道我在使用它,因为它在粒子内部(我有几个),所以我排除了这个原因。
我也检查了驱动兼容性问题,我更新到Ubuntu 20.04并且安装了amdgpu-pro驱动,但没有解决任何问题。
希望这会有所帮助。