mjlshen opened a new issue, #41172:
URL: https://github.com/apache/superset/issues/41172

   ### Bug description
   
   The default web-server entrypoint 
[docker/entrypoints/run-server.sh](https://github.com/apache/superset/blob/a19093e65a448ec2cc4e174e8b48077fbb970b01/docker/entrypoints/run-server.sh)
 invokes gunicorn as a child process rather than `exec`-ing it. As a result the 
bash wrapper remains PID in the container, and the SIGTERM that Kubernetes 
and/or `docker stop` sends on shutdown is delivered to bash, not to gunicorn. 
Bash does not forward the signal, so gunicorn never receives SIGTERM and never 
begins a graceful drain.
   
   In Kubernetes, the container then sits idel until 
`terminationGracePeriodSeconds` expires, at which point the kubelet sends 
SIGKILL. SIGKILL terminates gunicorn (and all workers) immediately, curring 
every in-flight request. This makes a clean rolling update impossible because 
every pod replacement drops connections that were still being served.
   
   ### Current Behavior
   
   PID 1 is `/bin/bash run-server.sh`. SIGTERM is swallowed by bash; gunicorn 
runs until SIGKILL.
   
   ```bash
   gunicorn \
     --bind "${SUPERSET_BIND_ADDRESS:-0.0.0.0}:${SUPERSET_PORT:-8088}" \
     ...
     "${FLASK_APP}"
   ```
   
   Logs: N/A - essentially the important finding is nothing that appears if you 
attempt to `grep -c "Handling signal: term"`
   
   ### Expected behavior
   
   gunicorn should be PID 1 so it receives SIGTERM directly and drains 
in-flight requests before exiting.
   
   ```bash
   exec gunicorn \
     --bind "${SUPERSET_BIND_ADDRESS:-0.0.0.0}:${SUPERSET_PORT:-8088}" \
     ...
     "${FLASK_APP}"
   ```
   
   Logs:
   ```
   [2026-06-17 20:31:51 +0000] [1]   [INFO] Handling signal: term
   [2026-06-17 20:31:51 +0000] [45]  [INFO] Worker exiting (pid: 45)
   ... (all workers exit) ...
   [2026-06-17 20:31:52 +0000] [1]   [INFO] Shutting down: Master
   ```
   
   run-server.sh does no work after the gunicorn call anyway, so adding this 
exec is safe and has no other behavioral effect.
   
   ### Screenshots/recordings
   
   _No response_
   
   ### Superset version
   
   6.1.0
   
   ### Python version
   
   3.11
   
   ### Node version
   
   Not applicable
   
   ### Browser
   
   Not applicable
   
   ### Additional context
   
   _No response_
   
   ### Checklist
   
   - [x] I have searched Superset docs and Slack and didn't find a solution to 
my problem.
   - [x] I have searched the GitHub issue tracker and didn't find a similar bug 
report.
   - [x] I have checked Superset's logs for errors and if I found a relevant 
Python stacktrace, I included it here as text in the "additional context" 
section.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to