<div dir="ltr">Max,<div><br></div><div>If you control the child code it shouldn't be too difficult to manage the exiting of children when erlang dies. Even if you don't control it you can create a little shim that does.</div><div><br></div><div>Few things you can mix and match:</div><div><br></div><div>1) On Linux you can use prctl with PR_SET_PDEATHSIG</div><div>2) look at parent pid on occasion. If it becomes 1 (or not what it was at start, slight race condition but you can set the value as an envvar) then you know your parent is dead.</div><div><span>3) In a shim use the old pipe trick (<a class="linkclass" href="http://skarnet.org/software/s6/s6-fghack.html">http://skarnet.org/software/s6/s6-fghack.html</a>). If the breaks then the other side is gone.</span></div><div><br></div><div>If using the shim approach you can then kill the child when the shim detects the parent's death.</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Mar 13, 2017 at 3:53 PM, Max Lapshin <span dir="ltr"><<a href="mailto:max.lapshin@gmail.com" target="_blank">max.lapshin@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra">I launch via  erlang:open_port and struggle a lot trying to make children stop when erlang server dies: it is not easy.</div><div class="gmail_extra"><br></div><div class="gmail_extra">then child ruby/python starts listening http port and erlang forwards all requests from wide web to launched http server.</div></div>
<br>______________________________<wbr>_________________<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/<wbr>listinfo/erlang-questions</a><br>
<br></blockquote></div><br></div>