debug tips?
Ulf Wiger (AL/EAB)
ulf.wiger@REDACTED
Wed Jun 1 16:31:55 CEST 2005
> I spent about two hours last night debugging a call into mnesia. I
> finally found my error but it took a very long time to
> step..step..step
> through many lines before I found exactly what triggered the
> mnesia:abort().
> The call into mnesia was:
> mnesia:create_table/2
> The problem of course is the return result was simply:
> {aborted,{bad_type,iserve_callback,disc_copies,'jon1@REDACTED'}}
The return result tells you that some input argument(s)
had were of the wrong type:
(foobey@REDACTED)18> mnesia:error_description(v(16)). {"Bad type on some provided arguments",
iserve_callback,
{disc_copies,foobey@REDACTED}}
The option that was badly typed was disc_copies,
and its value was (in your case) 'jon1@REDACTED',
when it should have been a list of nodes.
Granted, it is easy to overlook this the first dozen
or so times reading the mnesia manual. (:
> No stack trace...just a return from the shell process.
> By putting a breakpoint in mnesia_schema and stepping through
> for a very
> long time, I was finally able to catch the code which called
> mnesia:abort(). (There are many places in mnesia_schema where the
> mnesia:abort() is called).
You can also do this (see below). It produces a lot of output,
but can be quite useful in finding out where an error
occurs.
BR,
Uffe
(foobey@REDACTED)12> dbg:tracer().
{ok,<0.100.0>}
(foobey@REDACTED)13> dbg:tpl(mnesia_schema,'_','_',[{'_',[],[{message,{return_trace}}]}]).
{ok,[{matched,foobey@REDACTED,233},{saved,1}]}
(foobey@REDACTED)14> dbg:p(all,[c]).
{ok,[{matched,foobey@REDACTED,59}]}
(foobey@REDACTED)16> mnesia:create_table(iserve_callback,[{disc_copies,node()}]).
(<0.44.0>) call mnesia_schema:create_table([{name,iserve_callback},{disc_copies,foobey@REDACTED}])
(<0.44.0>) call mnesia_schema:schema_transaction(#Fun<mnesia_schema.6.100766404>)
...
(<0.108.0>) call mnesia_schema:verify({alt,[nil,list]},nil,{bad_type,iserve_callback,{ram_copies,[]}})
(<0.108.0>) call mnesia_schema:do_verify({alt,[nil,list]},nil,{bad_type,iserve_callback,{ram_copies,[]}})
(<0.108.0>) returned from mnesia_schema:do_verify/3 -> ok
(<0.108.0>) returned from mnesia_schema:verify/3 -> ok
(<0.108.0>) call mnesia_schema:verify({alt,[nil,list]},atom,{bad_type,iserve_callback,{disc_copies,foobey@REDACTED}})
(<0.108.0>) call mnesia_schema:do_verify({alt,[nil,list]},atom,{bad_type,iserve_callback,{disc_copies,foobey@REDACTED}})
(<0.44.0>) returned from mnesia_schema:schema_transaction/1 -> {aborted,
{bad_type,
iserve_callback,
{disc_copies,
foobey@REDACTED}}}
(<0.44.0>) returned from mnesia_schema:create_table/1 -> {aborted,
{bad_type,
iserve_callback,
{disc_copies,
foobey@REDACTED}}}
More information about the erlang-questions
mailing list