aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIgor Sysoev <igor@sysoev.ru>2009-08-26 15:12:28 +0000
committerIgor Sysoev <igor@sysoev.ru>2009-08-26 15:12:28 +0000
commit450659e62a74d2f4abe17c7a0dec77ffd3b9f123 (patch)
tree7d7783e3f2d2d9fb88b0e2a084cda51316dd1420
parent31f6c5c55d8b047aa68e5f7667020331b3e078ba (diff)
downloadnginx-450659e62a74d2f4abe17c7a0dec77ffd3b9f123.tar.gz
nginx-450659e62a74d2f4abe17c7a0dec77ffd3b9f123.zip
twice termination delay only after SIGALRM, otherwise many separate SIGCHLD
and SIGIO signals quickly increase delay to the level when SIGKILL is sent
-rw-r--r--src/os/unix/ngx_process.c1
-rw-r--r--src/os/unix/ngx_process_cycle.c6
-rw-r--r--src/os/unix/ngx_process_cycle.h1
3 files changed, 7 insertions, 1 deletions
diff --git a/src/os/unix/ngx_process.c b/src/os/unix/ngx_process.c
index f163651ee..48ba9d4db 100644
--- a/src/os/unix/ngx_process.c
+++ b/src/os/unix/ngx_process.c
@@ -373,6 +373,7 @@ ngx_signal_handler(int signo)
break;
case SIGALRM:
+ ngx_sigalrm = 1;
break;
case SIGIO:
diff --git a/src/os/unix/ngx_process_cycle.c b/src/os/unix/ngx_process_cycle.c
index 9cf594d7e..21521ec26 100644
--- a/src/os/unix/ngx_process_cycle.c
+++ b/src/os/unix/ngx_process_cycle.c
@@ -37,6 +37,7 @@ ngx_uint_t ngx_threaded;
sig_atomic_t ngx_reap;
sig_atomic_t ngx_sigio;
+sig_atomic_t ngx_sigalrm;
sig_atomic_t ngx_terminate;
sig_atomic_t ngx_quit;
sig_atomic_t ngx_debug_quit;
@@ -142,7 +143,10 @@ ngx_master_process_cycle(ngx_cycle_t *cycle)
for ( ;; ) {
if (delay) {
- delay *= 2;
+ if (ngx_sigalrm) {
+ delay *= 2;
+ ngx_sigalrm = 0;
+ }
ngx_log_debug1(NGX_LOG_DEBUG_EVENT, cycle->log, 0,
"termination cycle: %d", delay);
diff --git a/src/os/unix/ngx_process_cycle.h b/src/os/unix/ngx_process_cycle.h
index 8ef0c3154..f46ad463f 100644
--- a/src/os/unix/ngx_process_cycle.h
+++ b/src/os/unix/ngx_process_cycle.h
@@ -46,6 +46,7 @@ extern ngx_uint_t ngx_exiting;
extern sig_atomic_t ngx_reap;
extern sig_atomic_t ngx_sigio;
+extern sig_atomic_t ngx_sigalrm;
extern sig_atomic_t ngx_quit;
extern sig_atomic_t ngx_debug_quit;
extern sig_atomic_t ngx_terminate;