如果您执行“service nginx reload”2 次(这也适用于任何执行“reload”的命令,例如 systemctl reload nginx.service) - nginx 挂起并停止处理请求。
- Ubuntu 20.10
- nginx版本:nginx/1.18.0(Ubuntu)
算法:
root@srv# service nginx reload
root@srv# service nginx reload
nginx.service is not active, cannot reload.
root@srv# service nginx status
● nginx.service - A high performance web server and a reverse proxy server
Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)
Active: failed (Result: core-dump) since Mon 2021-03-22 12:18:00 MSK; 4s ago
Docs: man:nginx(8)
Process: 6747 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
Process: 6748 ExecStart=/usr/sbin/nginx -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
Process: 6798 ExecReload=/usr/sbin/nginx -g daemon on; master_process on; -s reload (code=exited, status=0/SUCCESS)
Main PID: 6749 (code=dumped, signal=SEGV)
Tasks: 0 (limit: 2281)
Memory: 792.0K
CGroup: /system.slice/nginx.service
Mar 22 12:18:00 vps-8355f791 systemd[1]: Reloaded A high performance web server and a reverse proxy server.
Mar 22 12:18:00 vps-8355f791 systemd[1]: nginx.service: Main process exited, code=dumped, status=11/SEGV
Mar 22 12:18:00 vps-8355f791 systemd[1]: nginx.service: Killing process 6750 (nginx) with signal SIGKILL.
Mar 22 12:18:00 vps-8355f791 systemd[1]: nginx.service: Killing process 6799 (nginx) with signal SIGKILL.
Mar 22 12:18:00 vps-8355f791 systemd[1]: nginx.service: Killing process 6750 (nginx) with signal SIGKILL.
Mar 22 12:18:00 vps-8355f791 systemd[1]: nginx.service: Killing process 6799 (nginx) with signal SIGKILL.
Mar 22 12:18:00 vps-8355f791 systemd[1]: nginx.service: Failed with result 'core-dump'.
Mar 22 12:18:00 vps-8355f791 systemd[1]: nginx.service: Unit process 6750 (nginx) remains running after unit stopped.
Mar 22 12:18:00 vps-8355f791 systemd[1]: nginx.service: Unit process 6799 (nginx) remains running after unit stopped.
Mar 22 12:18:03 vps-8355f791 systemd[1]: nginx.service: Unit cannot be reloaded because it is inactive.
Journalctl:
Mar 22 12:18:00 vps-8355f791 kernel: nginx[6749]: segfault at 10 ip 00007f0ebffa5b33 sp 00007fffa313d360 error 4 in libperl.so.5.30.3[7f0ebff3d000+167000]
Mar 22 12:18:00 vps-8355f791 kernel: Code: 48 89 43 10 48 83 c4 18 5b 5d 41 5c 41 5d 41 5e 41 5f c3 0f 1f 40 00 0f b6 7f 30 48 c1 e8 03 48 29 f8 48 89 c3 74 89 48 8b 02 <4c> 8b 68 10 4d 85 ed 0f 84 28 01 00 00 0f b6 40 30 49 c1 ed 03 49
Mar 22 12:18:00 vps-8355f791 systemd[1]: nginx.service: Main process exited, code=dumped, status=11/SEGV
Mar 22 12:18:00 vps-8355f791 systemd[1]: nginx.service: Killing process 6750 (nginx) with signal SIGKILL.
Mar 22 12:18:00 vps-8355f791 systemd[1]: nginx.service: Killing process 6799 (nginx) with signal SIGKILL.
Mar 22 12:18:00 vps-8355f791 systemd[1]: nginx.service: Killing process 6750 (nginx) with signal SIGKILL.
Mar 22 12:18:00 vps-8355f791 systemd[1]: nginx.service: Killing process 6799 (nginx) with signal SIGKILL.
Mar 22 12:18:00 vps-8355f791 systemd[1]: nginx.service: Failed with result 'core-dump'.
Mar 22 12:18:00 vps-8355f791 systemd[1]: nginx.service: Unit process 6750 (nginx) remains running after unit stopped.
Mar 22 12:18:00 vps-8355f791 systemd[1]: nginx.service: Unit process 6799 (nginx) remains running after unit stopped.
Mar 22 12:18:03 vps-8355f791 systemd[1]: nginx.service: Unit cannot be reloaded because it is inactive.
Mar 22 12:18:08 vps-8355f791 sudo[6814]: pam_unix(sudo:session): session opened for user root by (uid=0)
Mar 22 12:18:08 vps-8355f791 sudo[6816]: root : TTY=unknown ; PWD=/ ; USER=root ; COMMAND=/usr/sbin/service nginx restart
Mar 22 12:18:08 vps-8355f791 sudo[6816]: pam_unix(sudo:session): session opened for user root by (uid=0)
Mar 22 12:18:08 vps-8355f791 systemd[1]: Starting A high performance web server and a reverse proxy server...
Mar 22 12:18:08 vps-8355f791 systemd[1]: Started A high performance web server and a reverse proxy server.
Mar 22 12:18:08 vps-8355f791 sudo[6816]: pam_unix(sudo:session): session closed for user root
Mar 22 12:18:08 vps-8355f791 sudo[6814]: pam_unix(sudo:session): session closed for user root
同时,只要输入一次命令,一切都会顺利进行。但是如果你快速输入命令2次,就会发生冲突。