Supervisor process exits with 'exit status 1; not expected'
Solution 1
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
[program:my_app]
user=root
; rest of config follows
Solution 2
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.
Related videos on Youtube
Sævar
Updated on September 18, 2022Comments
-
Sævar over 1 year
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:
#!/bin/bash set -e LOGFILE=/var/log/gunicorn/my_app.log LOGDIR=$(dirname $LOGFILE) NUM_WORKERS=3 USER=my-www-user GROUP=my-www-user 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 \ my_app.wsgi:application
And my supervisor config looks like this:
[program:my_app] directory=/home/my-www-user/my_app/ user=my-www-user command=/home/my-www-user/my_app/server.sh stdout_logfile=/var/log/supervisor/my_app.log stderr_logfile=/var/log/supervisor/my_app-error.log autostart=true autorestart=true
When I
su
into themy-www-user
account the server starts normally. When I dosudo 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?
-
Flavian over 9 yearsThis is actually very dangerous, don't do that.
-
Will almost 6 years@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