I'm currently rebuilding my vps, and I'd like to use supervisor for managing my gunicorn/wsgi django processes. Thing is, supervisor keeps exiting the processes:

2010-07-23 14:54:40,575 INFO supervisord started with pid 31391
2010-07-23 14:54:41,582 INFO spawned: 'projectx' with pid 31395
2010-07-23 14:54:41,691 INFO exited: projectx (exit status 0; not expected)
2010-07-23 14:54:42,695 INFO spawned: 'projectx' with pid 31401
2010-07-23 14:54:42,801 INFO exited: projectx (exit status 0; not expected)
2010-07-23 14:54:44,806 INFO spawned: 'projectx' with pid 31404
2010-07-23 14:54:44,912 INFO exited: projectx (exit status 0; not expected)
2010-07-23 14:54:47,917 INFO spawned: 'projectx' with pid 31408
2010-07-23 14:54:48,022 INFO exited: projectx (exit status 0; not expected)
2010-07-23 14:54:49,023 INFO gave up: projectx entered FATAL state, too many start retries too quickly

This is the config I'm using:

command=/path/to/project/bin/gunicorn_django -c /path/to/project/project/gunicorn.conf.py /path/to/project/project/production.py

I already double checked, and gunicorn_django does return status 0 when it's spawned correctly.

I tried adding exitcodes=0,2 explicitly to the config, but that doesn't seem to make a difference either. It looks like the process is spawned correctly, but supervisor thinks it didn't.

Does anyone have a clue on how to solve this?

Thanks, Bjorn


If gunicorn_django is daemonizing itself, it's not the kind of program supervisor is designed to manage. Supervisor expects its supervised programs to run in the foreground so it can monitor if they've exited.

See supervisord docs.

  • gunicorn doesn't deamonize itself by default, but I did set it in my configuration file. I removed it, thanks for pointing that out. – Bjorn Jul 23 '10 at 19:02

Ok, after some puzzling I figured out it had something to do with users. I tried to run my child processes as a certain user. After removing the line (see my config below), everything is working fine.

Gunicorn config:

bind = ""
workers = 2

Supervisor config:

command=/path/to/project/bin/gunicorn_django -c /path/to/project/project/gunicorn.conf.py /path/to/project/project/production.py
; set the user here instead of in the gunicorn config.
  • 1
    Just a quick note that if you want to flesh this out, su'ing to myuser and running gunicorn should give a hint. The usual suspects are the log and pid files not being writable. Alternatively, your app might need file permissions as well. And just a quick note that for better supervisor support you should upgrade to 0.10 as we fixed an issue with restarting gunicorn via supervisord (or runit for that matter). – Paul J. Davis Jul 31 '10 at 3:39

I got a similar error when trying to execute an http daemon under supervisor.

Fixed by removing the old pid file: httpd_pid

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.