Re: disksup crashing when spawned/forked from process

Christopher Meiklejohn <[email protected]> Sun, 03 Dec 2017 23:55:00 +0000
Newsgroups gmane.comp.lang.erlang.general,gmane.comp.lang.erlang.bugs
Message-ID <CAGVmt0WfyakOZMb3kfThP28LG8hryTpYTuX-ZXUtfTL-V5MuCg@mail.gmail.com>
--===============1797389052358867695==
Content-Type: multipart/alternative; boundary="001a1143a63e0bbea9055f7855b8"

--001a1143a63e0bbea9055f7855b8
Content-Type: text/plain; charset="UTF-8"

Hi Luke,

Sorry for the delay in responding.  Yes, this is a relx/distillery wrapper
around launching beam.smp.

Thanks,
Christopher

On Thu, Nov 23, 2017 at 10:21 PM Luke Bakken <[email protected]> wrote:

> Hi Chris -
>
> What is "path_to_app_executable"? erl itself or a relx-type shell script
> sort of thing?
>
> On Nov 23, 2017 1:54 PM, "Christopher Meiklejohn" <
> [email protected]> wrote:
>
> I've got an Erlang/Elixir application that's being invoked via
> child_process in Node.js.  Outside of Node.js, it's fine.  Inside, the node
> crashes on startup with a badarg from disksup -- this is because the
> application requires that os_mon be started.
>
> A trivial reproducer is the following:
>
> var child_process = require('child_process');
> child_process.spawn(path_to_app_executable, ['foreground'],
>  { stdio: ignore,
>    detached: true });
>
> Included is the crash:
>
> 2017-11-23 21:26:04 =ERROR REPORT====
> ** Generic server disksup terminating
> ** Last message in was timeout
> ** When Server state == [{data,[{"OS",{unix,linux}},{"Timeout",1800000},{"Threshold",80},{"D
> iskData",[]}]}]
> ** Reason for termination ==
> ** {badarg,[{erlang,port_close,[#Port<0.2000>],[]},{disksup,terminate,2,[{file,"disksup.erl"
> },{line,169}]},{gen_server,try_terminate,3,[{file,"gen_server.erl"},{line,629}]},{gen_server
> ,terminate,7,[{file,"gen_server.erl"},{line,795}]},{proc_lib,init_p_do_apply,3,[{file,"proc_
> lib.erl"},{line,247}]}]}
> 2017-11-23 21:26:04 =CRASH REPORT====
>   crasher:
>     initial call: disksup:init/1
>     pid: <0.913.0>
>     registered_name: disksup
>     exception exit: {{badarg,[{erlang,port_close,[#Port<0.2000>],[]},{disksup,terminate,2,[{
> file,"disksup.erl"},{line,169}]},{gen_server,try_terminate,3,[{file,"gen_server.erl"},{line,
> 629}]},{gen_server,terminate,7,[{file,"gen_server.erl"},{line,795}]},{proc_lib,init_p_do_app
> ly,3,[{file,"proc_lib.erl"},{line,247}]}]},[{gen_server,terminate,7,[{file,"gen_server.erl"}
> ,{line,800}]},{proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,247}]}]}
>     ancestors: [os_mon_sup,<0.911.0>]
>     messages: []
>     links: [<0.912.0>]
>     dictionary: []
>     trap_exit: true
>     status: running
>     heap_size: 610
>     stack_size: 27
>     reductions: 368
>   neighbours:
> 2017-11-23 21:26:04 =SUPERVISOR REPORT====
>      Supervisor: {local,os_mon_sup}
>      Context:    child_terminated
>      Reason:     {badarg,[{erlang,port_close,[#Port<0.2000>],[]},{disksup,terminate,2,[{file
> ,"disksup.erl"},{line,169}]},{gen_server,try_terminate,3,[{file,"gen_server.erl"},{line,629}
> ]},{gen_server,terminate,7,[{file,"gen_server.erl"},{line,795}]},{proc_lib,init_p_do_apply,3
> ,[{file,"proc_lib.erl"},{line,247}]}]}
>      Offender:   [{pid,<0.913.0>},{id,disksup},{mfargs,{disksup,start_link,[]}},{restart_typ
> e,permanent},{shutdown,2000},{child_type,worker}]
>
>
> _______________________________________________
> erlang-questions mailing list
> [email protected]
> http://erlang.org/mailman/listinfo/erlang-questions
>
>
>

--001a1143a63e0bbea9055f7855b8
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">Hi Luke,<div><br></div><div>Sorry for the delay in respond=
ing.=C2=A0 Yes, this is a relx/distillery wrapper around launching beam.smp=
.</div><div><br></div><div>Thanks,</div><div>Christopher</div></div><br><di=
v class=3D"gmail_quote"><div dir=3D"ltr">On Thu, Nov 23, 2017 at 10:21 PM L=
uke Bakken &lt;<a href=3D"mailto:[email protected]">[email protected]</a>&gt; wro=
te:<br></div><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;b=
order-left:1px #ccc solid;padding-left:1ex"><div dir=3D"auto"><div>Hi Chris=
 -<div dir=3D"auto"><div dir=3D"auto"><br></div><div dir=3D"auto">What is &=
quot;path_to_app_executable&quot;? erl itself or a relx-type shell script s=
ort of thing?</div></div><div class=3D"gmail_extra"><br><div class=3D"gmail=
_quote"></div></div></div></div><div dir=3D"auto"><div><div class=3D"gmail_=
extra"><div class=3D"gmail_quote">On Nov 23, 2017 1:54 PM, &quot;Christophe=
r Meiklejohn&quot; &lt;<a href=3D"mailto:[email protected]" =
target=3D"_blank">[email protected]</a>&gt; wrote:<br type=
=3D"attribution"></div></div></div></div><div dir=3D"auto"><div><div class=
=3D"gmail_extra"><div class=3D"gmail_quote"><blockquote class=3D"m_-6405160=
552498100439quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;pa=
dding-left:1ex"><div dir=3D"ltr">I&#39;ve got an Erlang/Elixir application =
that&#39;s being invoked via child_process in Node.js.=C2=A0 Outside of Nod=
e.js, it&#39;s fine.=C2=A0 Inside, the node crashes on startup with a badar=
g from disksup -- this is because the application requires that os_mon be s=
tarted.<div><br></div><div>A trivial reproducer is the following:</div><div=
><br></div><div>var child_process =3D require(&#39;child_process&#39;);</di=
v><div>child_process.spawn(path_to_app_executable, [&#39;foreground&#39;],=
=C2=A0</div><div>=C2=A0{ stdio: ignore,=C2=A0</div><div>=C2=A0 =C2=A0detach=
ed: true });</div><div><br></div><div>Included is the crash:</div><div><pre=
 style=3D"word-wrap:break-word;white-space:pre-wrap">2017-11-23 21:26:04 =
=3DERROR REPORT=3D=3D=3D=3D
** Generic server disksup terminating
** Last message in was timeout
** When Server state =3D=3D [{data,[{&quot;OS&quot;,{unix,linux}},{&quot;Ti=
meout&quot;,1800000},{&quot;Threshold&quot;,80},{&quot;D
iskData&quot;,[]}]}]
** Reason for termination =3D=3D
** {badarg,[{erlang,port_close,[#Port&lt;0.2000&gt;],[]},{disksup,terminate=
,2,[{file,&quot;disksup.erl&quot;
},{line,169}]},{gen_server,try_terminate,3,[{file,&quot;gen_server.erl&quot=
;},{line,629}]},{gen_server
,terminate,7,[{file,&quot;gen_server.erl&quot;},{line,795}]},{proc_lib,init=
_p_do_apply,3,[{file,&quot;proc_
lib.erl&quot;},{line,247}]}]}
2017-11-23 21:26:04 =3DCRASH REPORT=3D=3D=3D=3D
  crasher:
    initial call: disksup:init/1
    pid: &lt;0.913.0&gt;
    registered_name: disksup
    exception exit: {{badarg,[{erlang,port_close,[#Port&lt;0.2000&gt;],[]},=
{disksup,terminate,2,[{
file,&quot;disksup.erl&quot;},{line,169}]},{gen_server,try_terminate,3,[{fi=
le,&quot;gen_server.erl&quot;},{line,
629}]},{gen_server,terminate,7,[{file,&quot;gen_server.erl&quot;},{line,795=
}]},{proc_lib,init_p_do_app
ly,3,[{file,&quot;proc_lib.erl&quot;},{line,247}]}]},[{gen_server,terminate=
,7,[{file,&quot;gen_server.erl&quot;}
,{line,800}]},{proc_lib,init_p_do_apply,3,[{file,&quot;proc_lib.erl&quot;},=
{line,247}]}]}
    ancestors: [os_mon_sup,&lt;0.911.0&gt;]
    messages: []
    links: [&lt;0.912.0&gt;]
    dictionary: []
    trap_exit: true
    status: running
    heap_size: 610
    stack_size: 27
    reductions: 368
  neighbours:
2017-11-23 21:26:04 =3DSUPERVISOR REPORT=3D=3D=3D=3D
     Supervisor: {local,os_mon_sup}
     Context:    child_terminated
     Reason:     {badarg,[{erlang,port_close,[#Port&lt;0.2000&gt;],[]},{dis=
ksup,terminate,2,[{file
,&quot;disksup.erl&quot;},{line,169}]},{gen_server,try_terminate,3,[{file,&=
quot;gen_server.erl&quot;},{line,629}
]},{gen_server,terminate,7,[{file,&quot;gen_server.erl&quot;},{line,795}]},=
{proc_lib,init_p_do_apply,3
,[{file,&quot;proc_lib.erl&quot;},{line,247}]}]}
     Offender:   [{pid,&lt;0.913.0&gt;},{id,disksup},{mfargs,{disksup,start=
_link,[]}},{restart_typ
e,permanent},{shutdown,2000},{child_type,worker}]</pre></div></div>
<br></blockquote></div></div></div></div><div dir=3D"auto"><div><div class=
=3D"gmail_extra"><div class=3D"gmail_quote"><blockquote class=3D"m_-6405160=
552498100439quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;pa=
dding-left:1ex">_______________________________________________<br>
erlang-questions mailing list<br>
<a href=3D"mailto:[email protected]" target=3D"_blank">erlang-que=
[email protected]</a><br>
<a href=3D"http://erlang.org/mailman/listinfo/erlang-questions" rel=3D"nore=
ferrer" target=3D"_blank">http://erlang.org/mailman/listinfo/erlang-questio=
ns</a><br>
<br></blockquote></div><br></div></div></div>
</blockquote></div>

--001a1143a63e0bbea9055f7855b8--

--===============1797389052358867695==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline