Skip to content

Instantly share code, notes, and snippets.

@patricksuo
Last active August 23, 2018 14:53
Show Gist options
  • Save patricksuo/cc9e7840a69103cb1db2ce4ac467abb5 to your computer and use it in GitHub Desktop.
Save patricksuo/cc9e7840a69103cb1db2ce4ac467abb5 to your computer and use it in GitHub Desktop.

dotnet core 诊断

managed 侧未捕获异常

目前可以通过查看 stdout/stderr 的栈排查。

unmanage 侧异常

需要使用 lldb 看 core 文件。建议在 docker 镜像 su21/dotnet 内重现 然后用 镜像内的 lldb 以及符号排查。 SceneServer/SceneServer/debugcore 是一个看 coredump 的辅助脚本。

卡死问题

目前 dotnet core 没有 golang 那种方便地打印所有线程栈和Task栈的手段。 一般排查问题是把整个进程做 dump 出来(使用 createdump 工具),然后用 lldb+sos 查看这个 dump。 Thread 应该简单,切换线程,看 stack trace 在 lldb 比较成熟。 Task 比较麻烦,一般思路是找到怀疑卡死的Task实例,然后看他的状态机状态码,就能知道卡在那个步骤。 具体参考 https://github.com/dotnet/coreclr/issues/14994#issuecomment-345295634

如何获取符号

https://github.com/dotnet/symstore/blob/master/src/dotnet-symbol/README.md 但实际上在中国下载这些符号很容易遇到网络问题。建议使用 docker 镜像 su21/dotnet

如何创建一个 minidump

https://github.com/dotnet/coreclr/blob/master/Documentation/botr/xplat-minidump-generation.md 但现在这个 createdump 还有bug。会自己 coredump 掉。 dotnet/diagnostics#61

lldb 相关参考

https://www.nesono.com/sites/default/files/lldb%20cheat%20sheet.pdf https://lldb.llvm.org/lldb-gdb.html

微软的 sos 参考

https://github.com/dotnet/coreclr/blob/master/Documentation/building/debugging-instructions.md

其他已知问题

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment