[erlang-questions] Strange Socket Behaviour Was:Parents always take children with them?
Ulf Wiger
ulf@REDACTED
Sun Apr 29 11:00:53 CEST 2007
It can be tricky to detect crashes in processes created using spawn().
One way to do it is to run SASL, and use proc_lib:spawn() instead:
1> application:start(sasl).
ok
...
=PROGRESS REPORT==== 29-Apr-2007::10:54:20 ===
application: sasl
started_at: nonode@REDACTED
2> spawn(fun() -> 1=2 end).
<0.43.0>
=ERROR REPORT==== 29-Apr-2007::10:54:32 ===
Error in process <0.43.0> with exit value:
{{badmatch,2},[{erl_eval,expr,3}]}
(now that particular error message was reported by the shell.)
3> proc_lib:spawn(fun() -> 1=2 end).
<0.45.0>
=CRASH REPORT==== 29-Apr-2007::10:55:11 ===
crasher:
pid: <0.45.0>
registered_name: []
error_info: {{badmatch,2},[{erl_eval,expr,3}]}
initial_call: #Fun<erl_eval.20.112921583>
ancestors: [<0.30.0>]
messages: []
links: []
dictionary: []
trap_exit: false
status: running
heap_size: 233
stack_size: 21
reductions: 83
neighbours:
BR,
Ulf W
2007/4/29, Matthias Lang <matthias@REDACTED>:
>
> Ludovic Coquelle writes:
>
> > ... so the normal behavior is that gen_recv doesn't block, which is
> probably
> > intended since you request 0 byte with infinity timeout
>
> More precisely, gen_tcp:recv(P, 0) will block until at least one octet
> of data is available, with the options Andrew is using.
>
> But yes, Andrew's problem is as you diagnosed: his "critical" line of
> code will crash the process because the second argument to io:format
> must be a list.
>
> Matthias
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://www.erlang.org/mailman/listinfo/erlang-questions
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20070429/ebbb32e5/attachment.htm>
More information about the erlang-questions
mailing list