Git Product home page Git Product logo

Comments (8)

adamcooke avatar adamcooke commented on May 31, 2024 1

For reference, here's the relevant code which demonstrates what signals actually do...

@signal_handler.register('TERM') { stop_supervisor }
@signal_handler.register('INT') { stop(:stop_supervisor => true) }
@signal_handler.register('USR1') { restart }
@signal_handler.register('HUP') { reload_config }

from procodile.

adamcooke avatar adamcooke commented on May 31, 2024 1

For debugging, take a look at the procodile.log which should show everything the supervisor is doing.

from procodile.

adamcooke avatar adamcooke commented on May 31, 2024

If you send a KILL signal to procodile, it will just kill the supervisor immediately. You should be sending INT to the procodile if you want it to shut down cleanly and stop its child processes too.

Edited to change TERM to INT. If you send the TERM signal it only stops the supervisor. If you send INT it stops everything.

from procodile.

nickooolas avatar nickooolas commented on May 31, 2024

Thanks @adamcooke, I'm talking about the following scenario:

  1. I setup a Docker Container & run a bash session, ie:
    docker exec -it xx_container_name_xx bash
    which just starts an interactive bash terminal session.

  2. Then run Procodile - procodile start (without --dev/foreground mode, runs as daemon?), and can confirm the supervisor starts up with a PID and confirmed by ps aux.

  3. Then go to kill the bash session, by Ctrl+C (TERM), and it just sits there, doing nothing, doesn't disconnect from the bash session.

What is Interesting: - if I run a seperate bash session into the same Docker container, it will connect, and disconnect without any problems, whilst the other one still sits there?

Questions:

  • Could it be one of the processes/workers holding it up?
  • How can I debug what is happening behind the scenes on the exit/TERM sig?
  • My understanding is that Ctrl+C sends the TERM signal?

from procodile.

adamcooke avatar adamcooke commented on May 31, 2024

If you send a TERM to bash, this will be propagated to its child processes (in this case the procodile supervisor). The supervisor will receive this and stop itself (but not its child processes). The processes that the supervisor started are started in a new process group so they won't receive any signals from upstream which means they'll likely continue indefinitely without any supervision.

Docker is possible just be waiting for all processes within the container to stop before actually stopping itself.

from procodile.

adamcooke avatar adamcooke commented on May 31, 2024

To answer your last question, CTRL+C usually sends the INT signal.

from procodile.

nickooolas avatar nickooolas commented on May 31, 2024

Great thanks @adamcooke, so I've determined that if Procodile is running in the foreground (ie, I can see the log trails, using --dev) then if I issue the Ctrl+C command, it will shut down, but not if it's running in normal mode procodile start without the --dev flag?

from procodile.

nickooolas avatar nickooolas commented on May 31, 2024

A bit more investigation on this, it seems that running the way that the Docker container is initiated defines whether or not Procodile is cleanly shutdown when escaping using Ctrl+C in a bash session:

from procodile.

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.