Pool cleanups are not called in the daemonization
|Reported by:||Owned by:|
|uname -a:||Linux machine_name 4.13.0-36-generic #40-Ubuntu SMP Fri Feb 16 20:07:48 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux|
|nginx -V:||nginx version: nginx/1.13.6|
When we run our testsuites with LeakSanitizer, we noticed lots of leak reports.
After some investigations, we found that the pool cleanups registered with ngx_cycle->pool are not invoked when the parent exits during the daemonization, which causes the leak reports.
I am not sure whether it is a bug, or should we change the testsuite to run Nginx in "daemon off" mode.
Anyway, it could be 'fixed' via a simple change:
--- a/src/os/unix/ngx_daemon.c +++ b/src/os/unix/ngx_daemon.c @@ -23,6 +23,7 @@ ngx_daemon(ngx_log_t *log) break; default: + ngx_destroy_pool(ngx_cycle->pool); exit(0); }
Note that this change doesn't cover signaller mode and error handling path.