debug tips?

Ulf Wiger (AL/EAB) <>
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,''}}

The return result tells you that some input argument(s)
had were of the wrong type:

()18> mnesia:error_description(v(16)).                            {"Bad type on some provided arguments",

The option that was badly typed was disc_copies,
and its value was (in your case) '',
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 


()12> dbg:tracer().
()13> dbg:tpl(mnesia_schema,'_','_',[{'_',[],[{message,{return_trace}}]}]).
()14> dbg:p(all,[c]).

()16> mnesia:create_table(iserve_callback,[{disc_copies,node()}]).                                     
(<0.44.0>) call mnesia_schema:create_table([{name,iserve_callback},{}])
(<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,{}})
(<0.108.0>) call mnesia_schema:do_verify({alt,[nil,list]},atom,{bad_type,iserve_callback,{}})
(<0.44.0>) returned from mnesia_schema:schema_transaction/1 -> {aborted,
(<0.44.0>) returned from mnesia_schema:create_table/1 -> {aborted,

More information about the erlang-questions mailing list