erlang使用100%的CPU之一

vin*_*itu 3 erlang stack-trace

我的项目被冻结的情况.我看到只有100%使用其中一个CPU(其余为0%,但我使用的是SMP).

我的管理控制台说:

=ERROR REPORT==== 11-Feb-2011::00:45:00 ===
** Node 'node@example.com' not responding **
** Removing (timedout) connection **
Run Code Online (Sandbox Code Playgroud)

之后我无法连接到节点.

如果我使用C++进行编程,我可以进行调试构建,当出现这种情况时,我可以附加到我的进程并查看它循环的代码.

但我怎么能在Erlang中做到这一点?我怎样才能获得调用堆栈或其他东西来帮助我理解错误的原因?

感谢您的任何帮助.

Yas*_*aev 6

您可以在命令行中使用调试信息编译模块:

$ erlc +debug_info module.erl
Run Code Online (Sandbox Code Playgroud)

或者在Erlang shell中:

1> c(module, debug_info).
ok
Run Code Online (Sandbox Code Playgroud)

当您已经开始流程时,您可以选择附加到工作流程.在erlang shell中启动调试器:

2> debugger:start().
Run Code Online (Sandbox Code Playgroud)

将出现调试器窗口.从菜单中选择Module - > Interpret,然后在Interpret Dialog窗口中选择要连接的相应模块.执行此操作后,您将在调试器的右侧窗口中看到您的模块.

现在选择Process - > Attach,Attach Process窗口应该出现.

  • @vinnitu + debug_info根本不会影响性能.它只会让光束变得更大. (2认同)