[erlang-questions] standard_error not handling eagain?
UENISHI Kota
kuenishi@REDACTED
Sun Aug 9 14:53:29 CEST 2015
Hi folks,
I'm asking here as I'm not sure how it should be although this looks
like a bug to me. Reproduced in MacOS (mine is 10.10.4) AND 18.0
(maint-18 HEAD), but couldn't reproduce in Linux (Ubuntu 14.04) with
18.0 or R16B02 with Mac.
To reproduce, it's pretty easy: just print out to standard_error by
using io:put_char/1 or io:format/3, with writing a long iolist at
least more than a thousand characters [1]:
main(_) ->
Arg0 = [ [["1234567890" || _ <- [1,2,3,4,5,6,7,8,9,0]], 32,
integer_to_list(L), $\n]
|| L <- lists:seq(1, 200) ],
io:format(standard_error, "~p~n", [whereis(standard_error)]),
R = io:put_chars(standard_error, Arg0),
io:format(standard_error, "~p, ~p~n", [R, whereis(standard_error)]).
My result of this code is also copied in that gist [2].
This phenomena seems to happen when writing a long buffer to FD 2 via
port driver and suddenly gets EAGAIN back, and the port exits with
that error. I believe standard_error should not exit but should retry
writing when eagain or eintr was received. Thoughts?
[1] https://gist.github.com/kuenishi/76333a8a93bc8ccad308#file-stderr-erl
[2] https://gist.github.com/kuenishi/76333a8a93bc8ccad308#file-otp-18-0-maint-18-head
--
UENISHI Kota :-)
More information about the erlang-questions
mailing list