Coder Social home page Coder Social logo

Comments (6)

Timrael avatar Timrael commented on August 15, 2024

Oh I found the line:
https://github.com/saleyn/erlexec/blob/master/c_src/exec.cpp#L982

If there is some reason why u write this?

from erlexec.

saleyn avatar saleyn commented on August 15, 2024

When a command gets run by exec with an alternative kill command: exec:run(Cmd, [{kill, KillCmd}]), the KillCmd is used to kill the spawned OS pid instead of using SIGTERM.

The transient_pids are the list of KillCmd processes that have been executed/forked and are still active. At exit of the port process the line you are referring to relates to the erlexec port trying to kill the active "kill commands". On that line it->first should not be equal to 1, and if it is, that's a bug, so if you could troubleshoot it to find out when/why it gets assigned, that would be helpful.

from erlexec.

Timrael avatar Timrael commented on August 15, 2024

I directed you to the wrong line, sorry. Here is my problem:
I start new OS process in my erlang app, for example mysql. And when I send "kill -9 pid_of_erlang_app" mysql goes down.

Another symptoms:

  1. when I create OS process through erlexec it dies with erlang app
  2. when I manage OS process through erlexec it does NOT die with erlang app

So I think there is problem with unlinking OS process with erlang app on creation.

from erlexec.

saleyn avatar saleyn commented on August 15, 2024

This is by design - the OS processes forked by erlexec are linked to it in a sense that when erlexec is signaled to be terminated (by loosing the connection to the Erlang VM that started it), it kills all forked children.

It would be possible to mark a child with "don't kill on exit" flag, and avoid killing it, though it is a new feature that would need to be implemented. However I see very little point in this - if you don't care about the forked process to be killed on exit, then why would you want to spawn it by erlexec to begin with instead of running it externally as a service?

from erlexec.

Timrael avatar Timrael commented on August 15, 2024

I'm writing some kind of Monit with elixir lang and this feature one of the main: monitoring of processes should not die with spawned processes, it should die alone and after resurrection manage spawned before processes. Your library is the only good way to execute and control OS processes from Erlang/Elixir, so if you skip this feature I will switch to another language. Please let me know about your decision.

from erlexec.

saleyn avatar saleyn commented on August 15, 2024

Why would you want to exit the Erlang VM? In your design you can have an Erlang agent node running as a daemon, that would control other pids (through erlexec), just like serviced or initd do. Your Monit interface would connect to active Erlang agent, and be able to start/control other OS pids. If you are concerned that an Erlang node could die - in a tested system that is a highly unlikely event, and if it does then it'll restart all dependencies.

In any event, you are welcome to submit a patch to handle this. I suppose you can pass a 'daemon' option to exec:run/2, which would fork a child, and "manage" it instead of "own"ing it.

from erlexec.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.