Giter Site home page Giter Site logo

Comments (9)

drnic avatar drnic commented on September 23, 2024

@milkotodorov sorry for not seeing this issue til now; do you have any suggestions for how the processes should be cleanly handled?

from bosh-gen.

jhunt avatar jhunt commented on September 23, 2024

Short of pulling the whole subtree of pids via some ps+grep hackery, I don't know of anyway to do this outside of C (or any language with ready access to both /proc and the raw system calls behind the kill / killall utilities).

Ideally, the root process would, upon receiving SIGTERM, turn around and kill its children, who would in turn kill their children, etc, etc.

from bosh-gen.

milkotodorov avatar milkotodorov commented on September 23, 2024

@drnic ideally killing the root process should kill it's children too.
Since we can find the children of a process we can iterate recursively and kill them all.
In this state all clild processes won't be terminated.

from bosh-gen.

drnic avatar drnic commented on September 23, 2024

@milkotodorov do you have some code that works for you in other places that you'd like to see in all bosh releases?

from bosh-gen.

milkotodorov avatar milkotodorov commented on September 23, 2024

@drnic I had an issue with a bash script which started a java app. So the PID that was recorded was the one of the script and killing this PID didn't kill the java process. So my solution was to record the java PID instead and kill it. But for a better solution I think something like a kill_pid_tree() function could be introduced.

from bosh-gen.

jhunt avatar jhunt commented on September 23, 2024

Typically that's why you should exec from the bash script after storing the process ID, then the Java process is the old script process, with the correct PID.

from bosh-gen.

jhunt avatar jhunt commented on September 23, 2024

@milkotodorov were you able to test if using exec works for you in this scenario?

from bosh-gen.

milkotodorov avatar milkotodorov commented on September 23, 2024

yes - it worked. Thanks

from bosh-gen.

drnic avatar drnic commented on September 23, 2024

Related to this topic: I am exploring the new https://github.com/cloudfoundry-incubator/bpm-release/ for wrapping job processes inside containers; it will mean we get rid of all our wrapper scripts.

WIP PR at #102

from bosh-gen.

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.