nginx-common nginx.service comments use wrong signal

Bug #1919965 reported by Lisbeth
10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
nginx (Debian)
New
Unknown
nginx (Ubuntu)
Triaged
Low
Thomas Ward

Bug Description

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

apt-cache policy nginx-common:
nginx-common:
  Installed: 1.18.0-0ubuntu1
  Candidate: 1.18.0-0ubuntu1
  Version table:
 *** 1.18.0-0ubuntu1 500
        500 http://ap-northeast-1c.clouds.ports.ubuntu.com/ubuntu-ports focal-updates/main arm64 Packages
        100 /var/lib/dpkg/status
     1.17.10-0ubuntu1 500
        500 http://ap-northeast-1c.clouds.ports.ubuntu.com/ubuntu-ports 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).

    [Service]
    Type=forking
    PIDFile=/run/nginx.pid
    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/nginx.pid
    TimeoutStopSec=5

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 ​http://nginx.org/en/docs/control.html , nginx receive QUIT instead of STOP.

also, refrring to the linux signal(7) ​https://man7.org/linux/man-pages/man7/signal.7.html

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

Tags: bitesize
Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

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
Revision history for this message
Thomas Ward (teward) wrote :
Bryce Harrington (bryce)
Changed in nginx (Ubuntu):
status: Confirmed → Triaged
Changed in nginx (Debian):
status: Unknown → New
Revision history for this message
Lucas Kanashiro (lucaskanashiro) wrote :

The last comment in the Debian bug mentions that the bug should be fixed in version 1.19.1, so hopefully it will get fixed once the package is updated.

Revision history for this message
Athos Ribeiro (athos-ribeiro) wrote :

While the mentioned Debian bug [1] describes an issue that is related to the one reported here (also reported upstream at [2], and fixed with [3]), this specific bug is not related with the sockets that are note being removed after the graceful shutdown (SIGQUIT).

This request is to substitute

# ExecStop sends SIGSTOP (graceful stop) to the nginx process.

with

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

in nginx.service since the comment is currently mentioning the wrong signal (ExecStop is indeed sending SIGQUIT instead of SIGSTOP already).

Since this is a very small, low priority change, I forwarded it to debian at

https://salsa.debian.org/nginx-team/nginx/-/merge_requests/14.

This should be enough to get this bug closed. However, we may want to file a separate bug to track [1] in case we want [3] backported.

[1] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=821111
[2] https://trac.nginx.org/nginx/ticket/753
[3] http://hg.nginx.org/nginx/rev/7cbf6389194b

tags: removed: needs-upstream-report
Revision history for this message
Athos Ribeiro (athos-ribeiro) wrote :
Revision history for this message
Athos Ribeiro (athos-ribeiro) wrote :

The Debian MR has been merged and will be released in 1.18.0-7 [1]. Once that version is sync'd (or merged) into Ubuntu, we can close this issue and track any remaining ones in LP: #1957320.

[1] https://salsa.debian.org/nginx-team/nginx/-/merge_requests/14

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

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