Opened 18 months ago

Last modified 18 months ago

#2401 new enhancement

Deployment on Heroku: add options to handle SIGTERM

Reported by: PetrDlouhy@… Owned by:
Priority: minor Milestone:
Component: documentation Version: 1.19.x
Keywords: Cc:
uname -a: Linux petr-ws 5.15.0-39-generic #42-Ubuntu SMP Thu Jun 9 23:42:32 UTC 2022 x86_64 GNU/Linux
nginx -V: nginx version: nginx/1.22.0
built by gcc 10.2.1 20210110 (Debian 10.2.1-6)
configure arguments: --without-http_rewrite_module

Description

I am using Nginx on Heroku in Docker container along with Gunicorn/Supervisor.

When Heroku scales down it first sends SIGTERM to all processes in the container and after 30 seconds it sends SIGKILL. I don't think, that I can change this behavior.

After receiving SIGTERM Nginx terminates ungracefully not waiting for running requests.

I wonder if the possibility to terminate gracefully on SIGTERM signal could be added.

Change History (1)

comment:1 by PetrDlouhy@…, 18 months ago

I found temporary workaround by compiling Nginx from sources and patching them:

curl -L http://nginx.org/download/nginx-1.22.0.tar.gz -o nginx.tar.gz
tar -xvzf nginx.tar.gz
cd nginx-1.22.0
sed -i "s/ QUIT$/TIUQ/g" src/core/ngx_config.h
sed -i "s/ TERM$/QUIT/g" src/core/ngx_config.h
sed -i "s/ TIUQ$/TERM/g" src/core/ngx_config.h
./configure
make
make install
Note: See TracTickets for help on using tickets.