Opened 4 years ago

Closed 4 years ago

Last modified 2 years ago

#2150 closed defect (invalid)

comments in systemd documents may use the wrong signal

Reported by: lisbethw1130@… Owned by:
Priority: minor Milestone:
Component: nginx-package Version: 1.18.x
Keywords: Cc: lisbethw1130@…
uname -a: Linux ip-10-0-3-118 5.4.0-1024-aws #24-Ubuntu SMP Sat Sep 5 06:17:48 UTC 2020 aarch64 aarch64 aarch64 GNU/Linux
nginx -V: nginx version: nginx/1.18.0 (Ubuntu)
built with OpenSSL 1.1.1f 31 Mar 2020
TLS SNI support enabled
configure arguments: --with-cc-opt='-g -O2 -fdebug-prefix-map=/build/nginx-WUOw6x/nginx-1.18.0=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC -Wdate-time -D_FORTIFY_SOURCE=2' --with-ld-opt='-Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-z,now -fPIC' --prefix=/usr/share/nginx --conf-path=/etc/nginx/nginx.conf --http-log-path=/var/log/nginx/access.log --error-log-path=/var/log/nginx/error.log --lock-path=/var/lock/nginx.lock --pid-path=/run/nginx.pid --modules-path=/usr/lib/nginx/modules --http-client-body-temp-path=/var/lib/nginx/body --http-fastcgi-temp-path=/var/lib/nginx/fastcgi --http-proxy-temp-path=/var/lib/nginx/proxy --http-scgi-temp-path=/var/lib/nginx/scgi --http-uwsgi-temp-path=/var/lib/nginx/uwsgi --with-debug --with-compat --with-pcre-jit --with-http_ssl_module --with-http_stub_status_module --with-http_realip_module --with-http_auth_request_module --with-http_v2_module --with-http_dav_module --with-http_slice_module --with-threads --with-http_addition_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_image_filter_module=dynamic --with-http_sub_module --with-http_xslt_module=dynamic --with-stream=dynamic --with-stream_ssl_module --with-mail=dynamic --with-mail_ssl_module

Description

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

Change History (2)

comment:1 by Maxim Dounin, 4 years ago

Resolution: invalid
Status: newclosed

This looks like a text from nginx package provided by Ubuntu (and/or Debian). It should be reported to Ubuntu and/or Debian package maintainers instead, relevant links can be found here and here.

in reply to:  1 comment:2 by lisbethw1130@…, 4 years ago

Replying to Maxim Dounin:

This looks like a text from nginx package provided by Ubuntu (and/or Debian). It should be reported to Ubuntu and/or Debian package maintainers instead, relevant links can be found here and here.

Thank you so much, I will report them :)

Note: See TracTickets for help on using tickets.