I'm trying to run a gunicorn_django process in supervisor but it always exits immediately, giving this error:

INFO exited: my_app (exit status 1; not expected)
INFO received SIGCLD indicating a child quit
INFO gave up: my_app entered FATAL state, too many start retries too quickly

My server script looks like this:

set -e
LOGDIR=$(dirname $LOGFILE)
cd /home/my-www-user/my_app
source /home/my-www-user/.virtualenvs/my_app/bin/activate
test -d $LOGDIR || mkdir -p $LOGDIR
gunicorn_django -w $NUM_WORKERS --debug \
 --user=$USER --group=$GROUP \
 --log-level=debug --log-file=$LOGFILE 2>>$LOGFILE\
 --pythonpath=my_app --settings=settings.active \

And my supervisor config looks like this:


When I su into the my-www-user account the server starts normally. When I do sudo supervisorctl start my_app it simply hangs until I do CTRL-c, then I find the error above in the supervisord.log file.

Does anyone have a clue about what I am missing?


I seem to have found the solution. I can't have supervisor run my server script as the unprivileged my-www-user since it has to write to log files etc that requires more access. So the solution is to run the server as root and let gunicorn_django spawn the worker process as my-www-user

; rest of config follows
  • 1
    This is actually very dangerous, don't do that. – Flavian Oct 30 '14 at 12:07
  • @Flavian got an alternative? I am new to this, and that was not something I had anticipated I would face, and while mine runs successfully, it warns me that no user was specified, so it's running as root. I also figure I am right not to worry much since it's running in a docker container and to get into it, you need my root password on host machine – Will Jun 2 '18 at 17:53

I had this error trying to run Celery, and i had exactly the opposite problem. I changed my user from root to www-data and that solved it.

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.