[erlang-questions] Tracing ejabberd

Vlad12 <>
Wed May 14 20:01:14 CEST 2008


 Update: problem solved. You guys were right, the binary installation of
ejabberd lacks many debugging modules for the erlang shell. 

I installed the source code package and dbg works just fine inside the
ejabberdctl erlang shell. I was able to obtain a trace.

Thank all of you for the help 





Vlad12 wrote:
> 
>  When i do the commands like you said, I get the following error: 
> 
> ()3> net_adm:ping().
> pong
> ()5> nodes().                         
> []
> ()6> dbg:tracer().
> {ok,<0.51.0>}
> ()8> lists:foreach(fun(Node) -> dbg:n(Node) end, nodes()).
> 
> =ERROR REPORT==== 14-May-2008::11:14:14 ===
> Error in process <0.399.0> on node '' with exit value:
> {undef,[{#Fun<dbg.26.18082825>,[]}]}
> 
>  It somehow seems that it does not support any dbg functions on the node
> itself even if i start them from another node. Is there a way I can modify
> some ejabberd scripts to include the dbg library when starting the
> ejabberd node? 
> 
> 
> 
> Francesco Cesarini (Erlang Consulting) wrote:
>> 
>> You are probably running Erlang in embedded mode, which loads all the 
>> modules at startup. I assume that the runtime tools application is not 
>> part of the build. That is where dbg is.
>> 
>> Also, because of the strange setup with ejabberd, you probably need to 
>> play around before you are able to get any trace messages.
>> to run dbg on an ejabbed node and bypass the group leader io problem, 
>> you have to
>> 
>> * Start a distributed Erlang Node
>> * Connect to the Ejabberd Cluster
>> * Start the tracer
>> * Connect the ejabberd nodes to the tracer
>> * Pick which processes and functions to trace
>> 
>> In pseudo code, you would do something like this:
>> 
>> erl -sname dbg -setcookie COOKIE   (Where COOKIE is the same cookie as 
>> the ejabberd node)
>> 
>> 1> net_adm:ping(EJABBERDNODENAME). (Where EJABBERDNODENAME is the 
>> distributed Erlang node name running on EjabberD).
>> 2> dbg:tracer().
>> 3> lists:foreach(fun(Node) -> dbg:n(Node) end, nodes()).
>> 
>> You can now use all of the trace commands and get the ourput redirected 
>> to your shell. They include dbg:p/2 to pick which processes to trace and 
>> dbg:tp for global calls and dbg:tpl for local ones.
>> 
>> hope this helps,
>> Francesco
>> --
>> http://www.erlang-consulting.com
>> 
>> Tuncer Ayaz wrote:
>>> On Tue, May 13, 2008 at 9:28 PM, Vlad12 <> wrote:
>>>   
>>>>  Hello,
>>>>
>>>>  Can anyone tell me why every time i run ejabberd on "live" mode (opens
>>>> an
>>>>  erlang shell at the node  ) it does not allow me to
>>>> run
>>>>  dbg or fprof functions?
>>>>
>>>>  shell$ ./ejabberdct live
>>>>
>>>>  This is what i get if i try to run dbg:tracer(). :
>>>>
>>>>  ()4> dbg:tracer().
>>>>  ** exited: {undef,[{dbg,tracer,[]},
>>>>                    {erl_eval,do_apply,5},
>>>>                    {shell,exprs,6},
>>>>                    {shell,eval_loop,3}]} **
>>>>     
>>>
>>> If I may trust my slowly building Erlang skills this
>>> error means that the system is unable to locate either
>>> the module 'dbg' or the method 'dbg:tracer'.
>>>
>>> A wild guess is that ejabberd's runtime config does not
>>> include too many additional libs/modules.
>>>
>>> The solution to your problem is something which I hope
>>> to know soon after having digged deeper into ejabberd.
>>> I know this doesn't solve your issue but may help
>>> clear the situation.
>>>
>>>   
>>>>  =ERROR REPORT==== 13-May-2008::13:21:29 ===
>>>>  Error in process <0.334.0> on node '' with exit
>>>> value:
>>>> 
>>>> {undef,[{dbg,tracer,[]},{erl_eval,do_apply,5},{shell,exprs,6},{shell,eval_loop,3}]}
>>>>
>>>>
>>>>  The error message is similar if i run fprof:trace(start). :
>>>>
>>>>  ()9> fprof:trace(start).
>>>>  {'EXIT',<0.354.0>,
>>>>         {undef,[{dbg,trace_port,[file,"fprof.trace"]},
>>>>                 {fprof,open_dbg_trace_port,2},
>>>>                 {fprof,handle_req,3},
>>>>                 {fprof,server_loop,1}]}}
>>>>
>>>>  =ERROR REPORT==== 13-May-2008::13:25:53 ===
>>>>  Error in process <0.354.0> on node '' with exit
>>>> value:
>>>> 
>>>> {undef,[{dbg,trace_port,[file,"fprof.trace"]},{fprof,open_dbg_trace_port,2},{fprof,handle_req,3},{fprof,server_loop,1}]}
>>>>
>>>>   Help is greatly appreciated
>>>>     
>>> _______________________________________________
>>> erlang-questions mailing list
>>> 
>>> http://www.erlang.org/mailman/listinfo/erlang-questions
>>>
>>>   
>> 
>> _______________________________________________
>> erlang-questions mailing list
>> 
>> http://www.erlang.org/mailman/listinfo/erlang-questions
>> 
>> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Tracing-ejabberd-tp17216480p17237372.html
Sent from the Erlang Questions mailing list archive at Nabble.com.




More information about the erlang-questions mailing list