I'm using supervisor 3 to daemonize a python process, which is launched through a bash script that sets up some configuration for python. The bash script runs python program in the foreground, FWIW.

This setup has the following problem: when supervisord tries to kill the process, it only kills the bash script, not the python process. So I end up leaking python processes running old code and all sorts of problems ensue. How can I fix this?

Is there some configuration option for supervisor to tell it to kill child processes as well?

Would it help to have the bash script trap the TERM signal and explicitly pass it on to the child? This seems unnecessary since when I run it from an interactive shell, the child python process is killed just fine.

I see that supervisor lets me pick which signal to kill with, defaulting to TERM right now. Might changing that help?


Here's a similar question on Stackoverflow:

Tornado doesn't restart cleanly in supervisor

Solution that worked for me was to use stopasgroup = true in the relevant [program:x] group.


I recently wrote an article that discusses this problem and explains how to solve it properly:


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.