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

Eduardo Habkost ehabkost at raisama.net
Tue Nov 15 16:38:31 UTC 2011


Hi,

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.

bender:~# ps ax -H | grep nginx
31603 pts/2    S+     0:00             grep nginx
32606 ?        S      0:00   nginx: master process /usr/local/nginx/sbin/nginx
32607 ?        S      9:47     nginx: worker process
31309 ?        S      0:00     nginx: master process /usr/local/nginx/sbin/nginx
31310 ?        S      0:00       nginx: worker process
bender:~# kill -WINCH 32606 # 32606 is the 1.0.9 master process, 31309
is the 1.0.10 master process
bender:~# ps ax -H | grep nginx
31605 pts/2    S+     0:00             grep nginx
32606 ?        S      0:00   nginx: master process /usr/local/nginx/sbin/nginx
32607 ?        S      9:47     nginx: worker process
31309 ?        S      0:00     nginx: master process /usr/local/nginx/sbin/nginx
31310 ?        S      0:00       nginx: worker process

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.

[1] http://wiki.nginx.org/CommandLine#Upgrading_To_a_New_Binary_On_The_Fly

--
Eduardo


Shell session:

bender:~# ps ax -H | grep nginx
31678 pts/2    S+     0:00             script -t -a /tmp/nginx.script
31679 pts/2    S+     0:00               script -t -a /tmp/nginx.script
31684 pts/5    S+     0:00                   grep nginx
bender:~# /usr/local/nginx/sbin/nginx
bender:~# ps ax -H | grep nginx
31678 pts/2    S+     0:00             script -t -a /tmp/nginx.script
31679 pts/2    S+     0:00               script -t -a /tmp/nginx.script
31689 pts/5    S+     0:00                   grep nginx
31686 ?        Ss     0:00   nginx: master process /usr/local/nginx/sbin/nginx
31687 ?        S      0:00     nginx: worker process
bender:~# kill -USR2 31686
bender:~# ps ax -H | grep nginx
31678 pts/2    S+     0:00             script -t -a /tmp/nginx.script
31679 pts/2    S+     0:00               script -t -a /tmp/nginx.script
31693 pts/5    S+     0:00                   grep nginx
31686 ?        Ss     0:00   nginx: master process /usr/local/nginx/sbin/nginx
31687 ?        S      0:00     nginx: worker process
31690 ?        S      0:00     nginx: master process /usr/local/nginx/sbin/nginx
31691 ?        S      0:00       nginx: worker process
bender:~# kill -WINCH 31686
bender:~# ps ax -H | grep nginx
31678 pts/2    S+     0:00             script -t -a /tmp/nginx.script
31679 pts/2    S+     0:00               script -t -a /tmp/nginx.script
31695 pts/5    S+     0:00                   grep nginx
31686 ?        Ss     0:00   nginx: master process /usr/local/nginx/sbin/nginx
31690 ?        S      0:00     nginx: master process /usr/local/nginx/sbin/nginx
31691 ?        S      0:00       nginx: worker process
bender:~# echo SIGWINCH worked on the first process
SIGWINCH worked on the first process
bender:~# kill -QUIT 31686
bender:~# ps ax -H | grep nginx
31678 pts/2    S+     0:00             script -t -a /tmp/nginx.script
31679 pts/2    S+     0:00               script -t -a /tmp/nginx.script
31697 pts/5    S+     0:00                   grep nginx
31690 ?        S      0:00   nginx: master process /usr/local/nginx/sbin/nginx
31691 ?        S      0:00     nginx: worker process
bender:~# kill -USR2 31690
bender:~# ps ax -H | grep nginx
31678 pts/2    S+     0:00             script -t -a /tmp/nginx.script
31679 pts/2    S+     0:00               script -t -a /tmp/nginx.script
31705 pts/5    S+     0:00                   grep nginx
31690 ?        S      0:00   nginx: master process /usr/local/nginx/sbin/nginx
31691 ?        S      0:00     nginx: worker process
31702 ?        S      0:00     nginx: master process /usr/local/nginx/sbin/nginx
31703 ?        S      0:00       nginx: worker process
bender:~# kill -WINCH 31690
bender:~# ps ax -H | grep nginx
31678 pts/2    S+     0:00             script -t -a /tmp/nginx.script
31679 pts/2    S+     0:00               script -t -a /tmp/nginx.script
31709 pts/5    S+     0:00                   grep nginx
31690 ?        S      0:00   nginx: master process /usr/local/nginx/sbin/nginx
31691 ?        S      0:00     nginx: worker process
31702 ?        S      0:00     nginx: master process /usr/local/nginx/sbin/nginx
31703 ?        S      0:00       nginx: worker process
bender:~# kill -WINCH 31690
bender:~# ps ax -H | grep nginx
31678 pts/2    S+     0:00             script -t -a /tmp/nginx.script
31679 pts/2    S+     0:00               script -t -a /tmp/nginx.script
31711 pts/5    S+     0:00                   grep nginx
31690 ?        S      0:00   nginx: master process /usr/local/nginx/sbin/nginx
31691 ?        S      0:00     nginx: worker process
31702 ?        S      0:00     nginx: master process /usr/local/nginx/sbin/nginx
31703 ?        S      0:00       nginx: worker process
bender:~# echo PID 31690 is ignoring SIGWINCH signals
PID 31690 is ignoring SIGWINCH signals
bender:~# kill -QUIT 31690
bender:~# ps ax -H | grep nginx
31678 pts/2    S+     0:00             script -t -a /tmp/nginx.script
31679 pts/2    S+     0:00               script -t -a /tmp/nginx.script
31713 pts/5    S+     0:00                   grep nginx
31702 ?        S      0:00   nginx: master process /usr/local/nginx/sbin/nginx
31703 ?        S      0:00     nginx: worker process



More information about the nginx mailing list