[erlang-questions] Erlang VM crashed due to io output?
Thu Jul 19 12:22:46 CEST 2007
On Thursday 19 July 2007 11:16, Ludovic Coquelle wrote:
> - - -
> That's the behaviour I expected.
> But if I try to pipe the result, erlang crash:
> bash> erl -noshell -eval "lists:foreach(fun(N) -> io:format(\"~w~n\", [N])
> end, lists:seq(1,5)), erlang:halt()." | head -n 3
> Crash dump was written to: erl_crash.dump
> init terminating in do_boot ()
> What's happening?
To see this you need to have core file size != 0
bash> ulimit -c 1000
When head has received three values it exits. (try with "tail -n 3", it works)
This cause the pipe (stdout) to terminate.
Erlang misinterprets this as an abnormal situation and dumps core.
> Is it a normal behaviour?
Maybe. But I rewrote it and tried to run it as a script
%% -*- erlang -*-
lists:foreach(fun(N) -> io:format("~w~n", [N])
And it still dumps core - not OK!
More information about the erlang-questions