[erlang-questions] Serve PHP/Python scripts behind Erlang

Antonio SJ Musumeci trapexit@REDACTED
Mon Mar 13 21:48:51 CET 2017


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.

Few things you can mix and match:

1) On Linux you can use prctl with PR_SET_PDEATHSIG
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.
3) In a shim use the old pipe trick (
http://skarnet.org/software/s6/s6-fghack.html). If the breaks then the
other side is gone.

If using the shim approach you can then kill the child when the shim
detects the parent's death.

On Mon, Mar 13, 2017 at 3:53 PM, Max Lapshin <max.lapshin@REDACTED> wrote:

> I launch via  erlang:open_port and struggle a lot trying to make children
> stop when erlang server dies: it is not easy.
> then child ruby/python starts listening http port and erlang forwards all
> requests from wide web to launched http server.
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20170313/31ad155a/attachment.htm>

More information about the erlang-questions mailing list