]> git.kaiwu.me - nginx.git/commitdiff
Silenced complaints about socket leaks on forced termination.
authorMaxim Dounin <mdounin@mdounin.ru>
Mon, 29 Jan 2024 07:29:39 +0000 (10:29 +0300)
committerMaxim Dounin <mdounin@mdounin.ru>
Mon, 29 Jan 2024 07:29:39 +0000 (10:29 +0300)
When graceful shutdown was requested, and then nginx was forced to
do fast shutdown, it used to (incorrectly) complain about open sockets
left in connections which weren't yet closed when fast shutdown
was requested.

Fix is to avoid complaining about open sockets when fast shutdown was
requested after graceful one.  Abnormal termination, if requested with
the WINCH signal, can still happen though.

src/os/unix/ngx_process_cycle.c
src/os/win32/ngx_process_cycle.c

index 98d2dd29b1498f2e014dcac0b014c39f023fca4d..5bc5ce9792df0d251b6a9dc943a0f2370335f4ca 100644 (file)
@@ -948,7 +948,7 @@ ngx_worker_process_exit(ngx_cycle_t *cycle)
         }
     }
 
-    if (ngx_exiting) {
+    if (ngx_exiting && !ngx_terminate) {
         c = cycle->connections;
         for (i = 0; i < cycle->connection_n; i++) {
             if (c[i].fd != -1
@@ -963,11 +963,11 @@ ngx_worker_process_exit(ngx_cycle_t *cycle)
                 ngx_debug_quit = 1;
             }
         }
+    }
 
-        if (ngx_debug_quit) {
-            ngx_log_error(NGX_LOG_ALERT, cycle->log, 0, "aborting");
-            ngx_debug_point();
-        }
+    if (ngx_debug_quit) {
+        ngx_log_error(NGX_LOG_ALERT, cycle->log, 0, "aborting");
+        ngx_debug_point();
     }
 
     /*
index 0c848eff4f8b7775cfa835f99c5c7d9d2505e788..a39335fd16feb16be72ffba812b9645922fde6c7 100644 (file)
@@ -834,7 +834,7 @@ ngx_worker_process_exit(ngx_cycle_t *cycle)
         }
     }
 
-    if (ngx_exiting) {
+    if (ngx_exiting && !ngx_terminate) {
         c = cycle->connections;
         for (i = 0; i < cycle->connection_n; i++) {
             if (c[i].fd != (ngx_socket_t) -1