Opened 2 years ago
Closed 2 years ago
#2387 closed defect (invalid)
nginx reloads spawn multiple processes for 3rd party modules
Reported by: | Owned by: | ||
---|---|---|---|
Priority: | major | Milestone: | |
Component: | nginx-core | Version: | 1.21.x |
Keywords: | signals, reload, process | Cc: | monkburger@… |
uname -a: | Linux xxx 3.10.0-1160.71.1.el7.x86_64 #1 SMP Tue Jun 28 15:37:28 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux | ||
nginx -V: | nginx version: nginx/1.21.6 |
Description
Not sure if this is a bug, or by design.
We're using the ngx_http_pipelog_module (https://github.com/pandax381/ngx_http_pipelog_module), and when we call a nginx -s reload, it spawns another set of processes.
Attaching strace / gdb to the logger process (pipelog's proc name), it's not being sent a signal (ie: TERM/KILL/QUIT), but nginx is actually creating another running instance of that module (complete with it's resources)
You can reproduce it by installing the above pipelog module, then configure it to use something like this pipe logger tool (https://pypi.org/project/tipimaid/). Once it's installed (and running), issue a few nginx -s reload commands and watch the 'logger process' go from 1 process to multiple (one for each reload command).
I've reproduced this on nearly all nginx versions in the last 2 years (Linux systems, from CentOS6 to Ubuntu)
Reloading the configuration implies that nginx parses new configuration, creates a new set of worker processes with the new configuration, and then stops old worker processes, see here.
If the particular 3rd party module fails to correctly handle configuration reload, you may want to report this to the module author.