need help debugging otp app

Ulf Wiger (AL/EAB) ulf.wiger@REDACTED
Fri Feb 11 15:42:04 CET 2005


In http://www.erlang.org/ml-archive/erlang-questions/200501/msg00036.html,
Gary Hodgson asked for help in understanding the following cryptic error message:

--> erl -boot ./master -config ./sys -boot_var MYAPPS $DIR -sname n1 Error in process <0.1.0> with exit value: {badarg,[{erlang,'++',[<<6 bytes>>," in bootfile"]},{init,append,2},{init,concat,1},{init,get_var_value,2},{init,add_var,2},{init,fix_path,2},{init,make_path,4},{init,eval_script,7},{init,do_boot,3}]} {"init terminating in do_boot",{badarg,[{erlang,'++',[<<6 bytes>>," in bootfile"]},{init,append,2},{init,concat,1},{init,get_var_value,2},{init,add_var,2},{init,fix_path,2},{init,make_path,4},{init,eval_script,7},{init,do_boot,3}]}} init terminating in do_boot () 

Hopefully, he has found a way around it by now.  (:


The probable error is that the script contains a boot variable which wasn't set when starting the system.

I ran into this problem myself just now. Looking at my own .script file, the following line:

         {path,["$CCV/ccviewer-R11A01/ebin"]},

introduced the "boot variable" $CCV. This has to be given a value at the erl command line:


erl -boot .../ccviewer -config ..../sys -boot_var CCV ...../CCviewer/lib

Erlang could be a little bit more helpful explaining what went wrong.


Looking at the error message, one might guess that either there's another boot var besides MYAPPS in the script (ROOT is handled automatically), or $DIR is not set correctly

Hope this helps.



BTW, the bug in init.erl seems to be this:

get_var_value(Var,[]) ->
    exit(list_to_atom(concat(["cannot expand \$", Var, " in bootfile"]))).

Var is a binary, so concat/1 fails with badarg.

With the attached patch (on OTP R10B-2), my own example now failed with 
the excellent error message:

{"init terminating in do_boot",'cannot expand $CCV in bootfile'}

Crash dump was written to: erl_crash.dump
init terminating in do_boot (cannot expand $CCV in bootfile)

which is much more helpful.

Patching init.erl is a bit tricky -- you should go to $ERL_TOP and type 'make',
since it is somehow linked into the BEAM runtime.

/Uffe

 <<init.erl.diff>> 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: init.erl.diff
Type: application/octet-stream
Size: 198 bytes
Desc: init.erl.diff
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20050211/1724d231/attachment.obj>


More information about the erlang-questions mailing list