SIGWINCH not working on second on-the-fly binary upgrade

Maxim Dounin mdounin at mdounin.ru
Tue Nov 15 17:55:47 UTC 2011


Hello!

On Tue, Nov 15, 2011 at 02:38:31PM -0200, Eduardo Habkost wrote:

> I was trying to upgrade nginx from 1.0.9 to 1.0.10 on-the-fly, using
> the process described on the wiki[1], but it looks like it is ignoring
> the SIGWINCH signal I send to it.

[...]

> After a quick look at the code, it looks like this happened because
> the 1.0.9 process I am running was started during a previous
> 1.0.7->1.0.9 on-the-fly upgrade, and the 1.0.9 master process now
> thinks it is not daemonized (ngx_daemonized is not set on
> initialization if ngx_inherited is set).
> 
> I have easily reproduced it by killing nginx completely, making a
> on-the-fly 1.0.10->1.0.10 executable upgrade twice. On the first try,
> SIGWINCH works; after the first upgrade, SIGWINCH stops working. Full
> shell session showing the bug is pasted at the end of my message.

Yes, thank you, this is a bug introduced in 1.1.1/1.0.9.

As a workaround SIGQUIT to old master process may be used (it 
doesn't allow to revive old master, but allow upgrade).

The following patch should fix this:

diff --git a/src/core/nginx.c b/src/core/nginx.c
--- a/src/core/nginx.c
+++ b/src/core/nginx.c
@@ -374,6 +374,10 @@ main(int argc, char *const *argv)
         ngx_daemonized = 1;
     }
 
+    if (ngx_inherited) {
+        ngx_daemonized = 1;
+    }
+
 #endif
 
     if (ngx_create_pidfile(&ccf->pid, cycle->log) != NGX_OK) {

Maxim Dounin



More information about the nginx mailing list