comparison src/os/unix/ngx_process_cycle.c @ 9201:791ead216b03

Silenced complaints about socket leaks on forced termination. 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.
author Maxim Dounin <mdounin@mdounin.ru>
date Mon, 29 Jan 2024 10:29:39 +0300
parents 8852f39311de
children 6a3ee145d0b5
comparison
equal deleted inserted replaced
9200:ee40e2b1d083 9201:791ead216b03
946 if (cycle->modules[i]->exit_process) { 946 if (cycle->modules[i]->exit_process) {
947 cycle->modules[i]->exit_process(cycle); 947 cycle->modules[i]->exit_process(cycle);
948 } 948 }
949 } 949 }
950 950
951 if (ngx_exiting) { 951 if (ngx_exiting && !ngx_terminate) {
952 c = cycle->connections; 952 c = cycle->connections;
953 for (i = 0; i < cycle->connection_n; i++) { 953 for (i = 0; i < cycle->connection_n; i++) {
954 if (c[i].fd != -1 954 if (c[i].fd != -1
955 && c[i].read 955 && c[i].read
956 && !c[i].read->accept 956 && !c[i].read->accept
961 "*%uA open socket #%d left in connection %ui", 961 "*%uA open socket #%d left in connection %ui",
962 c[i].number, c[i].fd, i); 962 c[i].number, c[i].fd, i);
963 ngx_debug_quit = 1; 963 ngx_debug_quit = 1;
964 } 964 }
965 } 965 }
966 966 }
967 if (ngx_debug_quit) { 967
968 ngx_log_error(NGX_LOG_ALERT, cycle->log, 0, "aborting"); 968 if (ngx_debug_quit) {
969 ngx_debug_point(); 969 ngx_log_error(NGX_LOG_ALERT, cycle->log, 0, "aborting");
970 } 970 ngx_debug_point();
971 } 971 }
972 972
973 /* 973 /*
974 * Copy ngx_cycle->log related data to the special static exit cycle, 974 * Copy ngx_cycle->log related data to the special static exit cycle,
975 * log, and log file structures enough to allow a signal handler to log. 975 * log, and log file structures enough to allow a signal handler to log.