[erlang-bugs] Crash when piping stdout to 'head'?

Eric Dahl eric.c.dahl@REDACTED
Sun May 3 18:02:45 CEST 2015


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-bugs/attachments/20150503/9f4795be/attachment.htm>


More information about the erlang-bugs mailing list