Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

erlang using 100% one of CPUs

I have situation when my project is frozen. I see only 100% usage one of the CPUs (the rest is 0%, but I'm using SMP).

And my admin console says:

=ERROR REPORT==== 11-Feb-2011::00:45:00 ===
** Node '[email protected]' not responding **
** Removing (timedout) connection **

After that I cannot connect to the node.

If I'm programming with C++ I can make a debug build and when such situation happens I can attach to my process and see the code where it is looping.

But how can I do it in Erlang? How can I get the call stack or something to help me understand what is really wrong?

Thank you for any help.

like image 939
vinnitu Avatar asked Jan 21 '23 12:01

vinnitu


2 Answers

You can compile your module with debug information in the command line:

$ erlc +debug_info module.erl

Or in Erlang shell:

1> c(module, debug_info).
ok

When you have already started your process, you have an option to attach to the working process. Start the debugger in your erlang shell:

2> debugger:start().

The debugger window will appear. From menu select Module -> Interpret and select the appropriate module, to which you want attach in the Interpret Dialog window. When you did, you will see your module in the right window of debugger.

Now select Process -> Attach, Attach Process window should appear.

like image 163
YasirA Avatar answered Feb 03 '23 22:02

YasirA


if the erlang distribution has shutdown you cannot use any remote debugging as you cannot connect to the node. You would have to connect to the pipes created by the VM at startup if configured to do so. See the http://www.erlang.org/doc/man/run_erl.html about how to do that.

You also might want to checkout this thread for a reason why your system is behaving the way it is: http://www.erlang.org/cgi-bin/ezmlm-cgi?4:mss:55859:201101:jconogbffcaogeijbdkl

like image 35
Lukas Avatar answered Feb 03 '23 22:02

Lukas