[From nobody Sun Jul  5 15:23:22 2026
Received: (at submit) by bugs.debian.org; 15 Apr 2016 16:17:59 +0000
X-Spam-Checker-Version: SpamAssassin 3.4.0-bugs.debian.org_2005_01_02
 (2014-02-07) on buxtehude.debian.org
X-Spam-Level: 
X-Spam-Status: No, score=-15.2 required=4.0 tests=BAYES_00,FOURLA,
 FROMDEVELOPER,HAS_PACKAGE,HEADER_FROM_DIFFERENT_DOMAINS,MURPHY_DRUGS_REL8,
 PGPSIGNATURE,RCVD_IN_DNSWL_LOW,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,
 RP_MATCHES_RCVD,SPF_HELO_PASS,SPF_PASS,UNPARSEABLE_RELAY,URIBL_CNKR
 autolearn=ham autolearn_force=no version=3.4.0-bugs.debian.org_2005_01_02
X-Spam-Bayes: score:0.0000 Tokens: new, 11; hammy, 150; neutral, 154; spammy,
 0. spammytokens: hammytokens:0.000-+--systemd,
 0.000-+--H*c:pgp-sha512, 
 0.000-+--UD:init.d, 0.000-+--initd, 0.000-+--init.d
Return-path: &lt;micah@riseup.net&gt;
Received: from mx1.riseup.net ([198.252.153.129])
 by buxtehude.debian.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from &lt;micah@riseup.net&gt;) id 1ar6RT-0008FR-2U
 for submit@bugs.debian.org; Fri, 15 Apr 2016 16:17:59 +0000
Received: from cotinga.riseup.net (unknown [10.0.1.164])
 (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits))
 (Client CN &quot;*.riseup.net&quot;,
 Issuer &quot;COMODO RSA Domain Validation Secure Server CA&quot; (verified OK))
 by mx1.riseup.net (Postfix) with ESMTPS id DECC41A205D
 for &lt;submit@bugs.debian.org&gt;; Fri, 15 Apr 2016 16:17:57 +0000 (UTC)
Received: from [127.0.0.1] (localhost [127.0.0.1])
 (Authenticated sender: micah) with ESMTPSA id 96C1040057
Received: by muck (Postfix, from userid 1000)
 id 6226A160302D; Fri, 15 Apr 2016 12:17:55 -0400 (EDT)
From: micah anderson &lt;micah@debian.org&gt;
To: submit@bugs.debian.org
Subject: nginx: Failure to remove socket due to Debian's method of stopping
Date: Fri, 15 Apr 2016 12:17:47 -0400
Message-ID: &lt;87k2jyn8wk.fsf@riseup.net&gt;
MIME-Version: 1.0
Content-Type: multipart/signed; boundary=&quot;==-=-=&quot;;
 micalg=pgp-sha512; protocol=&quot;application/pgp-signature&quot;
X-Virus-Scanned: clamav-milter 0.99 at mx1.riseup.net
X-Virus-Status: Clean
Delivered-To: submit@bugs.debian.org

--==-=-=
Content-Type: multipart/mixed; boundary=&quot;=-=-=&quot;

--=-=-=
Content-Type: text/plain
Content-Transfer-Encoding: quoted-printable

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 &quot;gradeful shutdown&quot;, 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:=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20
    + Gracefully stop nginx by default, we are switcing to a configurable=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20
      STOP/5/TERM/5/KILL/5 schedule. We are now in sync with the systemd=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20
      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 &quot;graceful&quot; 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).


--=-=-=
Content-Type: text/x-diff
Content-Disposition: inline; filename=nginx.init.diff
Content-Transfer-Encoding: quoted-printable
Content-Description: nginx initscript diff

=2D-- /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
=20
=2DSTOP_SCHEDULE=3D&quot;${STOP_SCHEDULE:-TERM/5/QUIT/5/KILL/5}&quot;
+STOP_SCHEDULE=3D&quot;${STOP_SCHEDULE:-QUIT/5/TERM/5/KILL/5}&quot;
=20
 test -x $DAEMON || exit 0
=20

--=-=-=
Content-Type: text/x-diff
Content-Disposition: attachment; filename=nginx.service.diff
Content-Transfer-Encoding: quoted-printable
Content-Description: nginx service diff

=2D-- /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=3D/usr/sbin/nginx -t -q -g 'daemon on; master_process on;'
 ExecStart=3D/usr/sbin/nginx -g 'daemon on; master_process on;'
 ExecReload=3D/usr/sbin/nginx -g 'daemon on; master_process on;' -s reload
=2DExecStop=3D-/sbin/start-stop-daemon --quiet --stop --retry TERM/5/QUIT/5=
/KILL/5 --pidfile /run/nginx.pid
+ExecStop=3D-/sbin/start-stop-daemon --quiet --stop --retry QUIT/5 --pidfil=
e /run/nginx.pid
 TimeoutStopSec=3D5
 KillMode=3Dmixed
=20

--=-=-=
Content-Type: text/plain


-- 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)

--=-=-=--

--==-=-=
Content-Type: application/pgp-signature; name=&quot;signature.asc&quot;

-----BEGIN PGP SIGNATURE-----

iQJ8BAEBCgBmBQJXERQrXxSAAAAAAC4AKGlzc3Vlci1mcHJAbm90YXRpb25zLm9w
ZW5wZ3AuZmlmdGhob3JzZW1hbi5uZXQ0Nzc3NTM1RkU1NDcxNTYyNjI2MDc3QjU4
Q0JGOUEzMjI4NjFBNzkwAAoJEIy/mjIoYaeQp64QAKE+aWRyWwPISIyKbcPYT55T
Qdo+i+AilLgIxl2In5CiQve23mbJ1sYvnry+NIT2ltQD4k5jQRHrLeFnVvp1kSAd
ZmDndXuHyQyKhOUFvC15Z3DS5jcJxJEZJIFQmqSx+FWGNpQMMF5LwzjQ6UyPUPex
q3BFuqR/tKF8hlZv9EfLtU4qMRJsl1vH9vpe/0ONzkhnWkkDvOSGsx1GTcr7z+YX
gUTNAa+MNE8NBBaNAhZo3ap4c8eMZBOrjKjYTXEHLSeFDceG9+Mr9zf5chAwPM2Q
lrsi8VOnHOXBZSiCmEFXnpl+oOIb/wQRiEmio9p3wKiodPPIkVr/lLjMcTe32VC0
eMKG315yiBBSyaTLpA5wcNB48iUEGXZFPjl7hE5MimhsIJXoel0MPpaG4Im5wwab
x7ZITiy4TdcmrQa/Ol8Wttpe3pMyBZDuDqCaFj1j/e88e1hIDNN9JSySRqaG0kgI
G8EC+MCYA9HFneKnj3hb2QaEB+RvSt+yeDIjDPdGF+P3AoCphb9pnL6qZIiHp/eM
c2LpZ4s1aBqGBSjB4PPaEGw5bde2VfIo1c+gu/+ddcAiDWpwSYOQelus0tmCkZZW
V229EUizQU2jdEbk8ztomQjPqf/0Ks+1AA1eqnJGafmL4WUXYn9wxUNjS8CCM+8D
qa1HH3LnzzKmZSDxSNkr
=Qz5n
-----END PGP SIGNATURE-----
--==-=-=--
]