[erlang-questions] something is looping, but can't figure out where.

Joe Armstrong <>
Tue May 27 14:16:17 CEST 2008


You can mess around with the BIFs processes() and process_info(Pid, Tag)

These BIFS are described in the man page for Erlang (erl -man erl) (or
pre-installed man pages for windows)   (or
http://www.erlang.org/doc/man/erlang.html))

processes() returns a list of all Pids in the system.

process_info(Pid, Tag) returns process information for the process
Pid. Tag says what kind of information
you want. process_info(Pid) returns even more info per process

A command like

> [ process_info(Pid) || Pid <- processes()]
...

Will help you track down which process has run  wild.

Exercise: using processes/0 and process_info/1 (or /2) write a
function find_looping_process() that
locates the bad process. Hint take two samples with 5 second intervals
and compare ...

/Joe Armstrong




On Sun, May 25, 2008 at 11:23 PM, Howard Yeh <> wrote:
> Hi,
>
> Earlier I was having problem with not getting the shell prompt back
> after a computation (with something looping & consuming memory).
> Putting the computation in a process seemed to have solved the
> problem.
>
> Now I am getting looping behaviour again. I am pretty sure my
> computation is not looping, since it raises an error (previously I
> could see the returned result). This time I have a timeout to kill the
> linked computation process after 10 seconds.
>
> After looping for 10 seconds, the computation process is killed, and i
> get the shell prompt back. But something keeps looping (pegs CPU, but
> consumes no memory).
>
> Does c:i() list all the processes? Looking at the reduction counts,
> nothing is increasing except the shell related processes. But those
> processes are only reducing my sending the i() command.
>
> I am really confused.
>
> Howard
> _______________________________________________
> erlang-questions mailing list
> 
> http://www.erlang.org/mailman/listinfo/erlang-questions
>



More information about the erlang-questions mailing list