supervisord stopping child processes

后端 未结 6 2023
隐瞒了意图╮
隐瞒了意图╮ 2020-12-23 09:38

One of the problems, I face with supervisord is that when I have a command which in turn spawns another process, supervisord is not able to kill it.

For example I h

相关标签:
6条回答
  • 2020-12-23 09:42

    The following article has an in-depth discussion of the problem:

    http://veithen.github.io/2014/11/16/sigterm-propagation.html

    0 讨论(0)
  • 2020-12-23 09:43

    Doing the following early in the main bash script called by supervisord fixed the problem for me:

    trap "kill -- -$$" EXIT
    

    This kills the entire process group when the main script exits, such as when it is killed by supervisord.

    0 讨论(0)
  • 2020-12-23 09:44

    A feature was recently added to supervisord to send SIGKILL to the whole process group. It's in github but not officially released yet.

    If the process id is available in a file, you can use the pid-proxy program

    0 讨论(0)
  • 2020-12-23 09:49

    You can also use priorities in /conf.d/your-configuration.conf file. For example, if you want to run zookeeper first and then kafka you can specify two programs.

    Lower priority means that the program starts first and stops last.

    0 讨论(0)
  • 2020-12-23 09:52

    The same problem was encountered by Rick Hanlon II here: https://coderwall.com/p/4tcw7w

    Option stopasgroup=true should be set in the program section for supervisord to stop not only the parent process but also the child processes.

    The example is given as:

    [program:some_django]
     command=python manage.py runserver
     directory=/dir/to/app
     stopasgroup=true
    

    Also, have in mind that you may have an older package of supervisord that does not have "stopasgroup" functionality. I tried these Debian packages on Raspberry Pi:

    • supervisor_3.0a8 does not work.
    • supervisor_3.0b2-1 works as expected.
    0 讨论(0)
  • 2020-12-23 09:59

    try this supervisor program config:

    stopasgroup=true
    killasgroup=true
    stopsignal=INT
    
    0 讨论(0)
提交回复
热议问题