问题描述
如何在使用 MONO 运行的挂起应用程序中显示线程(堆栈跟踪)?
How can I show the threads (stacktraces) in a hanging application that run with MONO?
我知道我可以在 .NET 中使用托管堆栈资源管理器 (MSE) 完成此操作.因为应用程序只在 MONO 上挂起,所以我需要用 MONO 来完成.
I know that I can do it in .NET with the Managed Stack Explorer (MSE). Because the application hang only with MONO that I need to do it with MONO.
或者有什么其他的办法可以找到挂的地方吗?
Or there are any other ideas how I can find the place of hanging?
推荐答案
假设你使用的是 Linux/Unix,而不是 Windows,向你的程序发送一个 SIGQUIT 信号.这可以通过
Assuming you're on Linux/Unix, not Windows, send a SIGQUIT signal to your program. This can be done with
kill -QUIT $PID
其中 $PID 是您的程序的 pid.然后 Mono 会将所有线程的堆栈跟踪转储到标准输出.请注意,尽管该进程在此之后继续运行,但您不应期望它保持可用/稳定.
where $PID is the pid of your program. Mono will then dump stack traces of all threads to stdout. Note that although the process stays running after this, you should not expect it to remain usable/stable.
有关背景信息,请参阅 http://en.wikipedia.org/wiki/SIGQUIT.
See http://en.wikipedia.org/wiki/SIGQUIT for some background.
注意:线程转储不会在您运行 kill
命令的终端窗口中打印出来.它将出现在单声道进程的标准错误中.
Note: The thread dump will not print out in the terminal window where you ran the kill
command. It will appear in the stderr of the mono process.
这篇关于如何使用 MONO 进行线程转储?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!