This is an automated email from the ASF dual-hosted git repository.

maximebeauchemin pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-superset.git


The following commit(s) were added to refs/heads/master by this push:
     new 522e801  Forward SIGTERM signal to gunicorn (#8156)
522e801 is described below

commit 522e8015cf462def88d37aa300a560012c0770ce
Author: Maxim Sukharev <[email protected]>
AuthorDate: Mon Sep 2 21:43:03 2019 +0200

    Forward SIGTERM signal to gunicorn (#8156)
    
    Currently docker entrypoint is a bash script.
    `docker stop` command (or restart in kubernetes) sends SIGTERM to the
    container but it isn't catched by gunicorn.
    So gunicorn can't start graceful shutdown which may lead to killing
    user's connection and also adds 10s (default value) delay for stopping
    until docker sends SIGKILL.
    Using `exec` replaces the shell with the process being opened and
    signals are propagated correctly.
    
    Ref: https://docs.docker.com/engine/reference/commandline/stop/
    Ref: 
https://unix.stackexchange.com/questions/146756/forward-sigterm-to-child-in-bash
---
 contrib/docker/docker-entrypoint.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/contrib/docker/docker-entrypoint.sh 
b/contrib/docker/docker-entrypoint.sh
index 474a583..03e4f96 100755
--- a/contrib/docker/docker-entrypoint.sh
+++ b/contrib/docker/docker-entrypoint.sh
@@ -27,7 +27,7 @@ elif [ "$SUPERSET_ENV" = "development" ]; then
     FLASK_ENV=development FLASK_APP=superset:app flask run -p 8088 
--with-threads --reload --debugger --host=0.0.0.0
 elif [ "$SUPERSET_ENV" = "production" ]; then
     celery worker --app=superset.sql_lab:celery_app --pool=gevent -Ofair &
-    gunicorn --bind  0.0.0.0:8088 \
+    exec gunicorn --bind  0.0.0.0:8088 \
         --workers $((2 * $(getconf _NPROCESSORS_ONLN) + 1)) \
         --timeout 60 \
         --limit-request-line 0 \

Reply via email to