[PATCH] Ensured SIGQUIT deletes listening UNIX socket files.
Thibault Charbonnier
thibaultcha at fastmail.com
Thu Feb 27 00:49:55 UTC 2020
# HG changeset patch
# User Thibault Charbonnier <thibaultcha at me.com>
# Date 1582764433 28800
# Wed Feb 26 16:47:13 2020 -0800
# Node ID 55ea1a9197a6f28d4da00909e5ea8585f6a08239
# Parent 4f18393a1d51bce6103ea2f1b2587900f349ba3d
Ensured SIGQUIT deletes listening UNIX socket files.
Prior to this patch, the SIGQUIT signal handling (graceful shutdown) did not
remove UNIX socket files since ngx_master_process_cycle reimplemented
listening
socket closings in lieu of using ngx_close_listening_sockets.
Since ngx_master_process_exit will call the aforementioned
ngx_close_listening_sockets, we can remove the custom implementation and now
expect listening sockets to be closed properly by
ngx_close_listening_sockets
instead.
This fixes the trac issue #753 (https://trac.nginx.org/nginx/ticket/753).
diff -r 4f18393a1d51 -r 55ea1a9197a6 src/os/unix/ngx_process_cycle.c
--- a/src/os/unix/ngx_process_cycle.c Thu Feb 20 16:51:07 2020 +0300
+++ b/src/os/unix/ngx_process_cycle.c Wed Feb 26 16:47:13 2020 -0800
@@ -77,12 +77,11 @@
u_char *p;
size_t size;
ngx_int_t i;
- ngx_uint_t n, sigio;
+ ngx_uint_t sigio;
sigset_t set;
struct itimerval itv;
ngx_uint_t live;
ngx_msec_t delay;
- ngx_listening_t *ls;
ngx_core_conf_t *ccf;
sigemptyset(&set);
@@ -205,16 +204,6 @@
ngx_signal_worker_processes(cycle,
ngx_signal_value(NGX_SHUTDOWN_SIGNAL));
- 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;
}
More information about the nginx-devel
mailing list