Welcome! Log In Create A New Profile

Advanced

[nginx] Silenced complaints about socket leaks on forced termination.

Sergey Kandaurov
January 30, 2024 10:10AM
details: https://hg.nginx.org/nginx/rev/791ead216b03
branches:
changeset: 9201:791ead216b03
user: Maxim Dounin <mdounin@mdounin.ru>
date: Mon Jan 29 10:29:39 2024 +0300
description:
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.

diffstat:

src/os/unix/ngx_process_cycle.c | 10 +++++-----
src/os/win32/ngx_process_cycle.c | 2 +-
2 files changed, 6 insertions(+), 6 deletions(-)

diffs (40 lines):

diff -r ee40e2b1d083 -r 791ead216b03 src/os/unix/ngx_process_cycle.c
--- a/src/os/unix/ngx_process_cycle.c Mon Dec 25 21:15:48 2023 +0400
+++ b/src/os/unix/ngx_process_cycle.c Mon Jan 29 10:29:39 2024 +0300
@@ -948,7 +948,7 @@ ngx_worker_process_exit(ngx_cycle_t *cyc
}
}

- 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 *cyc
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();
}

/*
diff -r ee40e2b1d083 -r 791ead216b03 src/os/win32/ngx_process_cycle.c
--- a/src/os/win32/ngx_process_cycle.c Mon Dec 25 21:15:48 2023 +0400
+++ b/src/os/win32/ngx_process_cycle.c Mon Jan 29 10:29:39 2024 +0300
@@ -834,7 +834,7 @@ ngx_worker_process_exit(ngx_cycle_t *cyc
}
}

- 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
_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
https://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

[nginx] Silenced complaints about socket leaks on forced termination.

Sergey Kandaurov 174 January 30, 2024 10:10AM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 291
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready