Ingo Fischer
2014-11-30 12:17:07 UTC
Hi all!
I'm running a Gunicorn server inside a schroot
<https://wiki.debian.org/Schroot> session via supervisor. My problem is
that the service is not fully stopped when stopping it with
"supervisorctl stop".
This is the script (simplified) controlling my server, it opens a
schroot session and runs gunicorn in it, in foreground:
#/bin/sh
# gunicorn.sh
schroot -c gunicorn -r -- bash -c "gunicorn --workers=1
myapp.wsgi:application"
This is my supervisor config to run this script:
# gunicorn.conf
[program:gunicorn]
command=/home/test/gunicorn.sh
stderr_logfile=/var/log/gunicorn.err.log
stdout_logfile=/var/log/gunicorn.out.log
When I start the service via "supervisorctl start" , my process tree
looks like this:
init(1)-supervisord(7175)---gunicorn.sh(8061)---schroot(8067)---gunicorn(8068)---gunicorn(8073)---{gunicorn}(8078)
Now when I stop the service with "supervisorctl stop", The corresponding
supervisor process and its direct child, gunicorn.sh, are terminated.
But the schroot process itself continues to live and is now a child of
the init process:
init(1)-schroot(8067)---gunicorn(8068)---gunicorn(8073)---{gunicorn}(8078)
This whole behavior might be related to the way schroot works.
But what I do not understand is that Supervisor config says that as long
as a process runs in foreground and stays attached to the console,
supervisor should be able to start/stop it. And I believe that this is
how my schroot-process behaves.
But still supervisor seems unable to stop the process.
What can I do to stop the gunicorn process correctly with supervisorctl
stop?
Thanks in advance!
Cheers, Ingo
I'm running a Gunicorn server inside a schroot
<https://wiki.debian.org/Schroot> session via supervisor. My problem is
that the service is not fully stopped when stopping it with
"supervisorctl stop".
This is the script (simplified) controlling my server, it opens a
schroot session and runs gunicorn in it, in foreground:
#/bin/sh
# gunicorn.sh
schroot -c gunicorn -r -- bash -c "gunicorn --workers=1
myapp.wsgi:application"
This is my supervisor config to run this script:
# gunicorn.conf
[program:gunicorn]
command=/home/test/gunicorn.sh
stderr_logfile=/var/log/gunicorn.err.log
stdout_logfile=/var/log/gunicorn.out.log
When I start the service via "supervisorctl start" , my process tree
looks like this:
init(1)-supervisord(7175)---gunicorn.sh(8061)---schroot(8067)---gunicorn(8068)---gunicorn(8073)---{gunicorn}(8078)
Now when I stop the service with "supervisorctl stop", The corresponding
supervisor process and its direct child, gunicorn.sh, are terminated.
But the schroot process itself continues to live and is now a child of
the init process:
init(1)-schroot(8067)---gunicorn(8068)---gunicorn(8073)---{gunicorn}(8078)
This whole behavior might be related to the way schroot works.
But what I do not understand is that Supervisor config says that as long
as a process runs in foreground and stays attached to the console,
supervisor should be able to start/stop it. And I believe that this is
how my schroot-process behaves.
But still supervisor seems unable to stop the process.
What can I do to stop the gunicorn process correctly with supervisorctl
stop?
Thanks in advance!
Cheers, Ingo