new stack backtrace

Ulf Wiger etxuwig@REDACTED
Tue Dec 14 11:09:44 CET 1999

On Tue, 14 Dec 1999, Martin Bjorklund wrote:

mbj>init_gws(Node) ->
mbj>    Cf  = bt_cmd:bgetconfig(Node, cluster),
mbj>    Gws =
mbj>	foldl(
mbj>	  fun({_, "FrontendCluster", _, Vs}, Gws1) ->
mbj>		  foldl(
mbj>		    fun({_,Gw,[SNd, Ip, SPort, Profile],_},Gws2) ->
mbj>			    Nd = list_to_atom(SNd),
mbj>			    Port = list_to_integer(SPort),
mbj>			    [{to_proto(Gw), Nd, Ip, Port, Profile} | Gws2];
mbj>		       (_, Gws2) ->
mbj>			    Gws2
mbj>		    end, Gws1, Vs);
mbj>	     (_, Gws1) ->
mbj>		  Gws1
mbj>	  end, [], Cf),
mbj>    GwRs = collect(Gws),
mbj>    foreach(fun(GwR) -> ets:insert(bt_tab, {{gw, GwR#bt_gw.protocol}, GwR}) end,
mbj>	    GwRs).
mbj>... after I got this crash:
mbj>    error_info: {undef,[{config_file,parse_string,["sh: /home...\n"]},
mbj>                        {bt_conf,init_gws,1},
mbj>                        {bt_conf,init_tab,1},
mbj>                        {btest,init_server,1},
mbj>                        {proc_lib,init_p,5}]}
mbj>Obviously, I have no calls to config_file:parse_string in
mbj>init_gws/1, as indicated by the backtrace.  But, init_gws calls
mbj>bt_cmd:get_config, which looks like this:
mbj>bgetconfig(Node, Type) ->
mbj>    Cmd = cmd("bgetconfig"),
mbj>    ibgetconfig(Cmd ++ " -t " ++ atom_to_list(Type) ++ " " ++
mbj>		atom_to_list(Node)).
mbj>ibgetconfig(Cmd) ->
mbj>    Res = os:cmd(Cmd),
mbj>    config_file:parse_string(Res).
mbj>... and there's the error.
mbj>The first question is why these last two calls don't show up in the
mbj>stack backtrace?

I know this one... I think!  (:

ibgetconfig/1 is tail-recursive, so it doesn't consume a stack frame
(I'm not sure whether that explanation is technically correct...)

I've been surprised by this myself, but it's fairly logical, I think.
Only functions with outstanding computations will show up in the stack


Ulf Wiger, Chief Designer AXD 301         <ulf.wiger@REDACTED>
Ericsson Telecom AB                          tfn: +46  8 719 81 95
Varuvägen 9, Älvsjö                          mob: +46 70 519 81 95
S-126 25 Stockholm, Sweden                   fax: +46  8 719 43 44

More information about the erlang-questions mailing list