]> git.kaiwu.me - nginx.git/commitdiff
twice termination delay only after SIGALRM, otherwise many separate SIGCHLD
authorIgor Sysoev <igor@sysoev.ru>
Wed, 26 Aug 2009 15:12:28 +0000 (15:12 +0000)
committerIgor Sysoev <igor@sysoev.ru>
Wed, 26 Aug 2009 15:12:28 +0000 (15:12 +0000)
and SIGIO signals quickly increase delay to the level when SIGKILL is sent

src/os/unix/ngx_process.c
src/os/unix/ngx_process_cycle.c
src/os/unix/ngx_process_cycle.h

index f163651eeaf900306fd63d8bceadb06bc8a6964d..48ba9d4db42799a6b37369e0fdecbe573e54795e 100644 (file)
@@ -373,6 +373,7 @@ ngx_signal_handler(int signo)
             break;
 
         case SIGALRM:
+            ngx_sigalrm = 1;
             break;
 
         case SIGIO:
index 9cf594d7e7a7abc0957050b4a60abd579baabc38..21521ec26cea58cd8987ac197de0eac8f0a7782b 100644 (file)
@@ -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);
index 8ef0c31547f81f90366e9554d4a3a88957b1c534..f46ad463fa697d01c0a1dbae7f2480c9545198be 100644 (file)
@@ -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;