Open fsteggink opened 3 years ago
Looks like this question on StackOverflow. Related to gunicorn
. Other sources also suggest to use CMD exec ...
.
But gunicorn
itself may also react on HUP signals in later versions: https://docs.gunicorn.org/en/stable/signals.html .
Yes, that is definitely the case. I'd use a trap for the TERM signal though, since that is what Docker sends (in my experience). In my own containers I've used signal handlers for the TERM signal and they work well.
So, for ghc_web it might be as simple as prepending exec
to the gunicorn
command in run-web.sh. However, the runner calls a paver
command (see run-runner.sh), but it's worth a try.
I can confirm that prepending exec
for the gunicorn
command works. The ghc_web command is shut down after a few seconds. However, the ghc_runner command still needs 10 seconds to shut down, although I'm using exec paver
now.
From the Gitter chat: I've noticed that when starting the runnerwithin the web app, multiple schedulers are started. This is because Gunicorn starts multiple workers. That might lead to potential conflicts (like same check executed simultaneously). Luckily the number of workers can be reduced by setting WSGI_WORKERS=1.
I'll submit a PR as a partial fix for this issue.
The correct PR for the partial fix is #376.
When using GHC with Docker I've noticed that the command
docker-compose down
takes about 10 seconds. This is an indication that the containers are removed forcefully by Docker. Probably the termination signal sent by Docker is not captured properly, which results in an unclean shutdown.