Fixed SIGQUIT not removing listening UNIX sockets (closes #753).

Listening UNIX sockets were not removed on graceful shutdown, preventing
the next runs.  The fix is to replace the custom socket closing code in
ngx_master_process_cycle() by the ngx_close_listening_sockets() call.
This commit is contained in:
Ruslan Ermilov 2020-06-01 22:31:23 +03:00
parent da370de990
commit 9c3ac44de2

View File

@ -77,12 +77,11 @@ ngx_master_process_cycle(ngx_cycle_t *cycle)
u_char *p; u_char *p;
size_t size; size_t size;
ngx_int_t i; ngx_int_t i;
ngx_uint_t n, sigio; ngx_uint_t sigio;
sigset_t set; sigset_t set;
struct itimerval itv; struct itimerval itv;
ngx_uint_t live; ngx_uint_t live;
ngx_msec_t delay; ngx_msec_t delay;
ngx_listening_t *ls;
ngx_core_conf_t *ccf; ngx_core_conf_t *ccf;
sigemptyset(&set); sigemptyset(&set);
@ -204,16 +203,7 @@ ngx_master_process_cycle(ngx_cycle_t *cycle)
if (ngx_quit) { if (ngx_quit) {
ngx_signal_worker_processes(cycle, ngx_signal_worker_processes(cycle,
ngx_signal_value(NGX_SHUTDOWN_SIGNAL)); ngx_signal_value(NGX_SHUTDOWN_SIGNAL));
ngx_close_listening_sockets(cycle);
ls = cycle->listening.elts;
for (n = 0; n < cycle->listening.nelts; n++) {
if (ngx_close_socket(ls[n].fd) == -1) {
ngx_log_error(NGX_LOG_EMERG, cycle->log, ngx_socket_errno,
ngx_close_socket_n " %V failed",
&ls[n].addr_text);
}
}
cycle->listening.nelts = 0;
continue; continue;
} }