nginx-common nginx.service comments use wrong signal

Bug #1919965 reported by Lisbeth on 2021-03-18
This bug affects 1 person
Affects Status Importance Assigned to Milestone
nginx (Debian)
nginx (Ubuntu)
Thomas Ward

Bug Description

lsb_release -rd:
Description: Ubuntu 20.04.1 LTS
Release: 20.04

apt-cache policy nginx-common:
  Installed: 1.18.0-0ubuntu1
  Candidate: 1.18.0-0ubuntu1
  Version table:
 *** 1.18.0-0ubuntu1 500
        500 focal-updates/main arm64 Packages
        100 /var/lib/dpkg/status
     1.17.10-0ubuntu1 500
        500 focal/main arm64 Packages

In ubuntu 20.04, nginx use systemd to control status of nginx, the following is part of the /lib/systemd/system/nginx.service

    # ExecStop sends SIGSTOP (graceful stop) to the nginx process.
    # If, after 5s (--retry QUIT/5) nginx is still running, systemd takes control
    # and sends SIGTERM (fast shutdown) to the main process.
    # After another 5s (TimeoutStopSec=5), and if nginx is alive, systemd sends
    # SIGKILL to all the remaining processes in the process group (KillMode=mixed).

    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 QUIT/5 --pidfile /run/

As comment said, execstop will send SIGSTOP, and SIGTERM after 5 seconds if process don't stop, but actually the command below use SIGQUIT instead of SIGSTOP to gracefully shutdown the process.

then I looked for the nginx documentation ​ , nginx receive QUIT instead of STOP.

also, refrring to the linux signal(7) ​

The signals SIGKILL and SIGSTOP cannot be caught, blocked, or ignored.

nginx shouldn't be able to capture SIGSTOP and take time to gracefully shutdown, SIGQUIT can

the comments above should change to

ExecStop sends SIGQUIT (graceful stop) to the nginx process.

If there's anything I missed it, pls let me know, thanks

Hi Lisbeth,
Thank you for taking the time to report this bug and helping to make Ubuntu better.
your report is absolutely right and I checked the latest Ubuntu 21.04 where this is still the case.
OTOH while correct this is also of a low severity.

I'm assigning Thomas who usually does the nginx uploads to fix this on one of the next uploads he does.

But on the other hand this issues isn't a Ubuntu-specific one, so you might even consider filing the very same report in the Debian bug tracker would then fix it for both at once - and then Ubuntu will pick it up on the next merge.

Would you mind filing a bug with Debian please?

tags: added: bitesize needs-upstream-report
Changed in nginx (Ubuntu):
assignee: nobody → Thomas Ward (teward)
status: New → Confirmed
importance: Undecided → Low
Thomas Ward (teward) wrote :
Bryce Harrington (bryce) on 2021-03-22
Changed in nginx (Ubuntu):
status: Confirmed → Triaged
Changed in nginx (Debian):
status: Unknown → New
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.