Crash when piping stdout to 'head'?

Eric Dahl <[email protected]> Sun, 3 May 2015 09:02:45 -0700
Newsgroups gmane.comp.lang.erlang.bugs
Message-ID <CAMOqA7fmbMfA8nFsMz_iDVz7_HsMBqEOo8Uv23bKXKd8TVxSqw@mail.gmail.com>
I'm relatively new to erlang but ran across a weird issue which seems like
a bug. When I redirect the output to 'head -20', it causes the VM to crash.
Some other types of pipes are fine though.

I've encountered this initially on FreeBSD 10.1 with Erlang/OTP 17 but also
reproduced on Ubuntu 14.04 with Erlang R16B03

Minimal test case below:

$ cat redirection_test.erl
-module(redirection_test).
-export([start/0]).

f(0) -> 0;
f(N) -> io:format("~p ~n", [N]), f(N-1).

start() -> io:format("~p ~n", [f(100)]).
$ erlc redirection_test.erl
$ erl -noinput -s redirection_test -s init stop  | head -20
100
99
...
84
83
82
81

Crash dump was written to: erl_crash.dump
init terminating in do_boot ()
$ uname -a
Linux erlang-test 3.13.0-43-generic #72-Ubuntu SMP Mon Dec 8 19:35:06 UTC
2014 x86_64 x86_64 x86_64 GNU/Linux
$ erl --version
Erlang R16B03 (erts-5.10.4) [source] [64-bit] [async-threads:10]
[kernel-poll:false]

Eshell V5.10.4  (abort with ^G)


Thanks,
Eric

_______________________________________________
erlang-bugs mailing list
[email protected]
http://erlang.org/mailman/listinfo/erlang-bugs