Package: nginx Version: 1.9.10-1 Severity: normal Tags: patch Hello,
It turns out that the way that Debian implements stopping nginx is by sending it, through the start-stop-daemon's --retry option a SIGQUIT to nginx, which is interpreted by nginx as a "gradeful shutdown", but it turns out is not very clean way to shutdown, and nginx developers think that nobody should be doing this[0]. The other stop method is the SIGTERM, which is what they are expecting people to send to shutdown nginx and it properly cleans up the sockets. If you configure nginx to use a unix socket for a listener, then when you restart, or stop and then start, nginx, it will fail to start because it will not clean up the listening socket because it was stopped with the 'SIGQUIT' method[1][2]. Additionally, in version 1.6.2-3 of the package upload this changelog entry appears: * debian/nginx-common.nginx.init: + Gracefully stop nginx by default, we are switcing to a configurable STOP/5/TERM/5/KILL/5 schedule. We are now in sync with the systemd service file. (Closes: #762708) However, the initscript and the systemd service file are *not* in sync. The systemd service file has just '--retry QUIT/5' and the initscript has 'QUIT/5/TERM/5/KILL/5', so these are most definitely not in sync. I've attached patches that syncs these up, and has them do a SIGTERM instead of a SIGQUIT because it appears to be more "graceful" and will properly clean up sockets. micah 0. https://trac.nginx.org/nginx/ticket/753#comment:5 1. https://trac.nginx.org/nginx/ticket/753 and 2. https://trac.nginx.org/nginx/ticket/952).
--- /tmp/nginx 2016-04-15 12:07:29.634756281 -0400 +++ /etc/init.d/nginx 2016-01-26 13:12:14.000000000 -0500 @@ -20,7 +20,7 @@ . /etc/default/nginx fi -STOP_SCHEDULE="${STOP_SCHEDULE:-TERM/5/QUIT/5/KILL/5}" +STOP_SCHEDULE="${STOP_SCHEDULE:-QUIT/5/TERM/5/KILL/5}" test -x $DAEMON || exit 0
--- /tmp/nginx.service 2016-04-15 12:07:12.135245311 -0400 +++ /lib/systemd/system/nginx.service 2016-01-26 13:12:14.000000000 -0500 @@ -20,7 +20,7 @@ ExecStartPre=/usr/sbin/nginx -t -q -g 'daemon on; master_process on;' ExecStart=/usr/sbin/nginx -g 'daemon on; master_process on;' ExecReload=/usr/sbin/nginx -g 'daemon on; master_process on;' -s reload -ExecStop=-/sbin/start-stop-daemon --quiet --stop --retry TERM/5/QUIT/5/KILL/5 --pidfile /run/nginx.pid +ExecStop=-/sbin/start-stop-daemon --quiet --stop --retry QUIT/5 --pidfile /run/nginx.pid TimeoutStopSec=5 KillMode=mixed
-- System Information: Debian Release: stretch/sid APT prefers unstable-debug APT policy: (500, 'unstable-debug'), (500, 'unstable'), (500, 'testing'), (1, 'experimental') Architecture: amd64 (x86_64) Foreign Architectures: i386 Kernel: Linux 4.4.0-1-amd64 (SMP w/8 CPU cores) Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/dash Init: systemd (via /run/systemd/system)
signature.asc
Description: PGP signature