Boost logo

Boost Users :

From: Ryan Ruhge (rruhge_at_[hidden])
Date: 2019-06-04 16:40:02


Boost Team:

We are trying to use boost process to have an always running process spawn
child processes in a fire and forget manner (don't wait or block on the
process that was just spawned). The issue we are running into is that the
child processes become zombie processes when finished until the parent
process completes. However in our system the parent process is never
intended to complete, it is always running and listening. We have provided
code snippets which give a simple example of the symptom we are
experiencing. It's an infinite loop (imitating our always running process)
that spawns processes that run and then become zombies instead of finishing
(I included a sleep so it doesn't spawn processes too quickly). Please
advise on whether there is something else we can do, if we are using child
or spawn wrong, or if we are using boost process in a manner that it is not
intended to be used.

Thanks,
Ryan Ruhge

#include <boost/process.hpp>

using namespace std;

int main() {

    while (true)

    {

        boost::process::spawn("sleep 10");

        sleep(5);

    }

}

#include <boost/process.hpp>

using namespace std;

int main() {

    while (true)

    {

        boost::process::child childProcess("sleep 10");

        childProcess.detach();

       sleep(5);

    }

}



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net