Repost/dbg:trace does not work on remote shell

Kaiduan Xie kaiduanx@REDACTED
Mon Jul 6 03:09:41 CEST 2009


Hi, all,

Repost on weird problem on dbg.

1. If I start ejabberd (version 2.0.1) with the following options (I
modify ejabberdctl)

start()
{
   erl \
     -name $NODE@$HOST \
     -pa $EJABBERD_EBIN \
     -mnesia dir "\"$EJABBERD_DB\"" \
     -s ejabberd \
     -ejabberd config \"$EJABBERD_CONFIG_PATH\" \
               log_path \"$EJABBERD_LOG_PATH\" \
     -sasl sasl_error_logger \{file,\"$SASL_LOG_PATH\"\}
}

dbg:trace can work on LIVE shell.

2. However, if I start ejabberd with a different option (using
original ejabberdctl start)

start()
{
   erl \
     -noinput -detached \
     -name $NODE@$HOST \
     -pa $EJABBERD_EBIN \
     -mnesia dir "\"$EJABBERD_DB\"" \
     -s ejabberd \
     -ejabberd config \"$EJABBERD_CONFIG_PATH\" \
               log_path \"$EJABBERD_LOG_PATH\" \
     -sasl sasl_error_logger \{file,\"$SASL_LOG_PATH\"\}
}

and attach a remote shell to the running ejabberd server using
ejabberdctl debug

debug()
{
   erl \
     -name debug$NODE@$HOST \
     -pa $EJABBERD_EBIN \
     -mnesia dir "\"$EJABBERD_DB\"" \
     -remsh $NODE@$HOST
}

dbg:trace() does not work on the remote shell.

kaiduanx@REDACTED:~/xmpp/ejabberd-2.0.1/tools$ ./ejabberdctl start
kaiduanx@REDACTED:~/xmpp/ejabberd-2.0.1/tools$ ./ejabberdctl debug
Erlang (BEAM) emulator version 5.6.5 [source] [async-threads:0] [hipe]
[kernel-poll:false]

Eshell V5.6.5  (abort with ^G)
(ejabberd@REDACTED)1> appmon:start().
{ok,<0.343.0>}
(ejabberd@REDACTED)2> dbg:tracer().
{ok,<0.353.0>}
(ejabberd@REDACTED)3> dbg:tpl('_', '_', '_', dbf:fun2ms(fun(_) ->
return_trace() end)).
** exception error: undefined function dbf:fun2ms/1
(ejabberd@REDACTED)4> dbg:tpl('_', '_', '_', dbg:fun2ms(fun(_) ->
return_trace() end)).
{ok,[{matched,'ejabberd@REDACTED',14795},{saved,1}]}
(ejabberd@REDACTED)5> dbg:p(list_to_pid("<0.258.0>"), [c, m]).
{ok,[{matched,'ejabberd@REDACTED',1}]}
(ejabberd@REDACTED)6>

Any idea why dbg does not work on remote shell? What is the practice
to trace a running OTP application , for example, a server running on
customer site remotely?

Thanks,

kaiduan


More information about the erlang-questions mailing list