<div dir="ltr">This fixes it:<div><br></div><div><a href="https://github.com/erlang/otp/pull/807">https://github.com/erlang/otp/pull/807</a><br></div><div><br></div><div>--steve</div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Aug 7, 2015 at 12:58 PM, Lukas Larsson <span dir="ltr"><<a href="mailto:garazdawi@gmail.com" target="_blank">garazdawi@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hello,<br>
<br>
Many thanks for the detailed analysis. I've gotten the similar reports from a couple of places.<br>
<br>
I'll take a look at it when I get back from summer vacation.<br>
<span class="HOEnZb"><font color="#888888"><br>
Lukas<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
<br>
> On 6 aug 2015, at 12:41, Andreas Schultz <<a href="mailto:aschultz@tpip.net">aschultz@tpip.net</a>> wrote:<br>
><br>
> Hi,<br>
><br>
> Since I upgraded to 18.0.2, my Erlang application Linux sometimes crash<br>
> with egain in standard error. The crash is triggered by something like this:<br>
><br>
>   io:format(standard_error, "started ~s~n", [application]).<br>
><br>
> The actual crash looks like this:<br>
><br>
> ** Generic server standard_error_sup terminating<br>
> ** Last message in was {'EXIT',<0.28.0>,eagain}<br>
> ** When Server state == {state,standard_error,undefined,<0.28.0>,{local,standard_error_sup}}<br>
> ** Reason for termination ==<br>
> ** eagain<br>
> 2015-08-06 09:14:41 =CRASH REPORT====<br>
>  crasher:<br>
>    initial call: supervisor_bridge:standard_error/1<br>
>    pid: <0.27.0><br>
>    registered_name: standard_error_sup<br>
>    exception exit: {eagain,[{gen_server,terminate,7,[{file,"gen_server.erl"},{line,826}]},{proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,239}]}]}<br>
>    ancestors: [kernel_sup,<0.10.0>]<br>
>    messages: []<br>
>    links: [<0.11.0>]<br>
>    dictionary: []<br>
>    trap_exit: true<br>
>    status: running<br>
>    heap_size: 376<br>
>    stack_size: 27<br>
>    reductions: 155<br>
>  neighbours:<br>
> 2015-08-06 09:14:41 =SUPERVISOR REPORT====<br>
>     Supervisor: {local,kernel_sup}<br>
>     Context:    child_terminated<br>
>     Reason:     eagain<br>
>     Offender:   [{pid,<0.27.0>},{id,standard_error},{mfargs,{standard_error,start_link,[]}},{restart_type,temporary},{shutdown,2000},{child_type,supervisor}]<br>
><br>
> I have straced erl and it does get an EAGAIN on fd 2:<br>
><br>
> 14209 09:14:41.170429 writev(2, [{"started gen_listener_tcp\n", 25}], 1 <unfinished ...><br>
> 14209 09:14:41.170446 <... writev resumed> ) = -1 EAGAIN (Resource temporarily unavailable)<br>
><br>
> So whats going on here???<br>
><br>
> After some searching I found a nice explanation about duped fd's and file status flags<br>
> here: <a href="http://stackoverflow.com/a/9677130" rel="noreferrer" target="_blank">http://stackoverflow.com/a/9677130</a> (a quick test program verifies that this indeed<br>
> happens on Linux).<br>
><br>
> So according to that, setting any of the stdio file descriptors to non-blocking, would<br>
> set all of them to non-blocking. And sure enough, strace shows this:<br>
><br>
>  14170 09:14:39.787004 fcntl(1, F_SETFL, O_RDWR|O_NONBLOCK|O_LARGEFILE) = 0<br>
><br>
> (pid 14170 is the main erl process, pid 14209 one of the threads in erl)<br>
><br>
> I have stopped digging through this at that point. Clearly, the standard_error<br>
> process or the underlying port driver should handle the EAGAIN gracefully, but<br>
> fail to do so.<br>
><br>
> Andreas<br>
> _______________________________________________<br>
> erlang-questions mailing list<br>
> <a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br>
> <a href="http://erlang.org/mailman/listinfo/erlang-questions" rel="noreferrer" target="_blank">http://erlang.org/mailman/listinfo/erlang-questions</a><br>
_______________________________________________<br>
erlang-questions mailing list<br>
<a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br>
<a href="http://erlang.org/mailman/listinfo/erlang-questions" rel="noreferrer" target="_blank">http://erlang.org/mailman/listinfo/erlang-questions</a><br>
</div></div></blockquote></div><br></div>