<br>It can be tricky to detect crashes in processes created using spawn().<br>One way to do it is to run SASL, and use proc_lib:spawn() instead:<br><br>1> application:start(sasl).<br>ok<br>...<br>=PROGRESS REPORT==== 29-Apr-2007::10:54:20 ===
<br>         application: sasl<br>          started_at: nonode@nohost<br>2> spawn(fun() -> 1=2 end).<br><0.43.0><br>=ERROR REPORT==== 29-Apr-2007::10:54:32 ===<br>Error in process <0.43.0> with exit value: {{badmatch,2},[{erl_eval,expr,3}]}
<br><br>   (now that particular error message was reported by the shell.)<br><br>3> proc_lib:spawn(fun() -> 1=2 end).<br><0.45.0><br>=CRASH REPORT==== 29-Apr-2007::10:55:11 ===<br>  crasher:<br>    pid: <0.45.0
><br>    registered_name: []<br>    error_info: {{badmatch,2},[{erl_eval,expr,3}]}<br>    initial_call: #Fun<erl_eval.20.112921583><br>    ancestors: [<0.30.0>]<br>    messages: []<br>    links: []<br>    dictionary: []
<br>    trap_exit: false<br>    status: running<br>    heap_size: 233<br>    stack_size: 21<br>    reductions: 83<br>  neighbours:<br><br>BR,<br>Ulf W<br><br><div><span class="gmail_quote">2007/4/29, Matthias Lang <<a href="mailto:matthias@corelatus.se">
matthias@corelatus.se</a>>:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Ludovic Coquelle writes:<br><br> > ... so the normal behavior is that gen_recv doesn't block, which is probably
<br> > intended since you request 0 byte with infinity timeout<br><br>More precisely, gen_tcp:recv(P, 0) will block until at least one octet<br>of data is available, with the options Andrew is using.<br><br>But yes, Andrew's problem is as you diagnosed:  his "critical" line of
<br>code will crash the process because the second argument to io:format<br>must be a list.<br><br>Matthias<br>_______________________________________________<br>erlang-questions mailing list<br><a href="mailto:erlang-questions@erlang.org">
erlang-questions@erlang.org</a><br><a href="http://www.erlang.org/mailman/listinfo/erlang-questions">http://www.erlang.org/mailman/listinfo/erlang-questions</a><br></blockquote></div><br>