Binary upgrade with systemd

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Binary upgrade with systemd

Marc Soda
Hello,

I’m using nginx 1.10.3 custom built on Ubuntu 16.04.  I’m also using the recommended systemd service file:

[Unit]
Description=The NGINX HTTP and reverse proxy server
After=syslog.target network.target remote-fs.target nss-lookup.target

[Service]
Type=forking
PIDFile=/run/nginx.pid
ExecStartPre=/usr/sbin/nginx -t
ExecStart=/usr/sbin/nginx
ExecReload=/bin/kill -s HUP $MAINPID
ExecStop=/bin/kill -s QUIT $MAINPID
PrivateTmp=true

[Install]
WantedBy=multi-user.target

I’m try to do a no downtime upgrade with the USR2 and WINCH signals.  Here is my process list before:

root     32277  0.0  0.4 1056672 71148 ?       Ss   21:51   0:00 nginx: master process /usr/local/nginx/sbin/nginx
www      32278  0.0  0.4 1057924 73152 ?       S<   21:51   0:00  \_ nginx: worker process
www      32279  0.0  0.4 1057924 73152 ?       S<   21:51   0:00  \_ nginx: worker process
www      32280  0.0  0.4 1057924 73152 ?       S<   21:51   0:00  \_ nginx: worker process
www      32281  0.0  0.4 1057924 73152 ?       S<   21:51   0:00  \_ nginx: worker process
www      32282  0.0  0.4 1057924 73152 ?       S<   21:51   0:00  \_ nginx: worker process
www      32283  0.0  0.4 1057924 73152 ?       S<   21:51   0:00  \_ nginx: worker process
www      32288  0.0  0.4 1057924 73152 ?       S<   21:51   0:00  \_ nginx: worker process
www      32289  0.0  0.4 1057924 73152 ?       S<   21:51   0:00  \_ nginx: worker process
www      32290  0.0  0.4 1057924 73152 ?       S<   21:51   0:00  \_ nginx: worker process
www      32291  0.0  0.4 1057924 73152 ?       S<   21:51   0:00  \_ nginx: worker process
www      32292  0.0  0.4 1057924 73152 ?       S<   21:51   0:00  \_ nginx: worker process
www      32293  0.0  0.4 1057924 73152 ?       S<   21:51   0:00  \_ nginx: worker process
www      32294  0.0  0.4 1056672 72212 ?       S    21:51   0:00  \_ nginx: cache manager process

and here it is after sending USR2:

root     32277  0.0  0.4 1056672 71868 ?       Ss   21:51   0:00 nginx: master process /usr/local/nginx/sbin/nginx
www      32278  0.0  0.4 1057924 73152 ?       S<   21:51   0:00  \_ nginx: worker process
www      32279  0.0  0.4 1057924 73152 ?       S<   21:51   0:00  \_ nginx: worker process
www      32280  0.0  0.4 1057924 73152 ?       S<   21:51   0:00  \_ nginx: worker process
www      32281  0.0  0.4 1057924 73152 ?       S<   21:51   0:00  \_ nginx: worker process
www      32282  0.0  0.4 1057924 73152 ?       S<   21:51   0:00  \_ nginx: worker process
www      32283  0.0  0.4 1057924 73152 ?       S<   21:51   0:00  \_ nginx: worker process
www      32288  0.0  0.4 1057924 73152 ?       S<   21:51   0:00  \_ nginx: worker process
www      32289  0.0  0.4 1057924 73152 ?       S<   21:51   0:00  \_ nginx: worker process
www      32290  0.0  0.4 1057924 73152 ?       S<   21:51   0:00  \_ nginx: worker process
www      32291  0.0  0.4 1057924 73152 ?       S<   21:51   0:00  \_ nginx: worker process
www      32292  0.0  0.4 1057924 73152 ?       S<   21:51   0:00  \_ nginx: worker process
www      32293  0.0  0.4 1057924 73152 ?       S<   21:51   0:00  \_ nginx: worker process
www      32294  0.0  0.4 1056672 72212 ?       S    21:51   0:00  \_ nginx: cache manager process
root     32461  5.5  0.5 1056676 82316 ?       S    22:01   0:00  \_ nginx: master process /usr/local/nginx/sbin/nginx
www      32465  0.0  0.4 1057928 73052 ?       S<   22:01   0:00      \_ nginx: worker process
www      32466  0.0  0.4 1057928 73052 ?       S<   22:01   0:00      \_ nginx: worker process
www      32467  0.0  0.4 1057928 73052 ?       S<   22:01   0:00      \_ nginx: worker process
www      32468  0.0  0.4 1057928 73052 ?       S<   22:01   0:00      \_ nginx: worker process
www      32469  0.0  0.4 1057928 73052 ?       S<   22:01   0:00      \_ nginx: worker process
www      32470  0.0  0.4 1057928 73052 ?       S<   22:01   0:00      \_ nginx: worker process
www      32471  0.0  0.4 1057928 73052 ?       S<   22:01   0:00      \_ nginx: worker process
www      32472  0.0  0.4 1057928 73052 ?       S<   22:01   0:00      \_ nginx: worker process
www      32473  0.0  0.4 1057928 73052 ?       S<   22:01   0:00      \_ nginx: worker process
www      32474  0.0  0.4 1057928 73052 ?       S<   22:01   0:00      \_ nginx: worker process
www      32475  0.0  0.4 1057928 73052 ?       S<   22:01   0:00      \_ nginx: worker process
www      32476  0.0  0.4 1057928 73052 ?       S<   22:01   0:00      \_ nginx: worker process
www      32477  0.0  0.4 1056676 72176 ?       S    22:01   0:00      \_ nginx: cache manager process
www      32478  0.0  0.4 1056676 72176 ?       S    22:01   0:00      \_ nginx: cache loader process

Notice how the new master is a child of the old master.  If I send a WINCH I get:

root     32277  0.0  0.4 1056672 71868 ?       Ss   21:51   0:00 nginx: master process /usr/local/nginx/sbin/nginx
root     32461  0.2  0.5 1056676 82316 ?       S    22:01   0:00  \_ nginx: master process /usr/local/nginx/sbin/nginx
www      32465  0.0  0.4 1057928 73052 ?       S<   22:01   0:00      \_ nginx: worker process
www      32466  0.0  0.4 1057928 73052 ?       S<   22:01   0:00      \_ nginx: worker process
www      32467  0.0  0.4 1057928 73052 ?       S<   22:01   0:00      \_ nginx: worker process
www      32468  0.0  0.4 1057928 73052 ?       S<   22:01   0:00      \_ nginx: worker process
www      32469  0.0  0.4 1057928 73052 ?       S<   22:01   0:00      \_ nginx: worker process
www      32470  0.0  0.4 1057928 73052 ?       S<   22:01   0:00      \_ nginx: worker process
www      32471  0.0  0.4 1057928 73052 ?       S<   22:01   0:00      \_ nginx: worker process
www      32472  0.0  0.4 1057928 73052 ?       S<   22:01   0:00      \_ nginx: worker process
www      32473  0.0  0.4 1057928 73052 ?       S<   22:01   0:00      \_ nginx: worker process
www      32474  0.0  0.4 1057928 73052 ?       S<   22:01   0:00      \_ nginx: worker process
www      32475  0.0  0.4 1057928 73052 ?       S<   22:01   0:00      \_ nginx: worker process
www      32476  0.0  0.4 1057928 73052 ?       S<   22:01   0:00      \_ nginx: worker process
www      32477  0.0  0.4 1056676 72176 ?       S    22:01   0:00      \_ nginx: cache manager process
www      32478  0.0  0.4 1056676 72176 ?       S    22:01   0:00      \_ nginx: cache loader process

which is not what I’m looking for.  Is this a limitation when running with systemd?

Thanks,
Marc

_______________________________________________
nginx mailing list
[hidden email]
http://mailman.nginx.org/mailman/listinfo/nginx
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Binary upgrade with systemd

Lucas Rolff-2
Hello Marc,

For which PID do you send the WINCH signal?


From: nginx <[hidden email]> on behalf of Marc Soda <[hidden email]>
Reply-To: "[hidden email]" <[hidden email]>
Date: Tuesday, 4 April 2017 at 04.04
To: "[hidden email]" <[hidden email]>
Subject: Binary upgrade with systemd

Hello,

I’m using nginx 1.10.3 custom built on Ubuntu 16.04.  I’m also using the recommended systemd service file:

[Unit]
Description=The NGINX HTTP and reverse proxy server
After=syslog.target network.target remote-fs.target nss-lookup.target

[Service]
Type=forking
PIDFile=/run/nginx.pid
ExecStartPre=/usr/sbin/nginx -t
ExecStart=/usr/sbin/nginx
ExecReload=/bin/kill -s HUP $MAINPID
ExecStop=/bin/kill -s QUIT $MAINPID
PrivateTmp=true

[Install]
WantedBy=multi-user.target

I’m try to do a no downtime upgrade with the USR2 and WINCH signals.  Here is my process list before:

root     32277  0.0  0.4 1056672 71148 ?       Ss   21:51   0:00 nginx: master process /usr/local/nginx/sbin/nginx
www      32278  0.0  0.4 1057924 73152 ?       S<   21:51   0:00  \_ nginx: worker process
www      32279  0.0  0.4 1057924 73152 ?       S<   21:51   0:00  \_ nginx: worker process
www      32280  0.0  0.4 1057924 73152 ?       S<   21:51   0:00  \_ nginx: worker process
www      32281  0.0  0.4 1057924 73152 ?       S<   21:51   0:00  \_ nginx: worker process
www      32282  0.0  0.4 1057924 73152 ?       S<   21:51   0:00  \_ nginx: worker process
www      32283  0.0  0.4 1057924 73152 ?       S<   21:51   0:00  \_ nginx: worker process
www      32288  0.0  0.4 1057924 73152 ?       S<   21:51   0:00  \_ nginx: worker process
www      32289  0.0  0.4 1057924 73152 ?       S<   21:51   0:00  \_ nginx: worker process
www      32290  0.0  0.4 1057924 73152 ?       S<   21:51   0:00  \_ nginx: worker process
www      32291  0.0  0.4 1057924 73152 ?       S<   21:51   0:00  \_ nginx: worker process
www      32292  0.0  0.4 1057924 73152 ?       S<   21:51   0:00  \_ nginx: worker process
www      32293  0.0  0.4 1057924 73152 ?       S<   21:51   0:00  \_ nginx: worker process
www      32294  0.0  0.4 1056672 72212 ?       S    21:51   0:00  \_ nginx: cache manager process

and here it is after sending USR2:

root     32277  0.0  0.4 1056672 71868 ?       Ss   21:51   0:00 nginx: master process /usr/local/nginx/sbin/nginx
www      32278  0.0  0.4 1057924 73152 ?       S<   21:51   0:00  \_ nginx: worker process
www      32279  0.0  0.4 1057924 73152 ?       S<   21:51   0:00  \_ nginx: worker process
www      32280  0.0  0.4 1057924 73152 ?       S<   21:51   0:00  \_ nginx: worker process
www      32281  0.0  0.4 1057924 73152 ?       S<   21:51   0:00  \_ nginx: worker process
www      32282  0.0  0.4 1057924 73152 ?       S<   21:51   0:00  \_ nginx: worker process
www      32283  0.0  0.4 1057924 73152 ?       S<   21:51   0:00  \_ nginx: worker process
www      32288  0.0  0.4 1057924 73152 ?       S<   21:51   0:00  \_ nginx: worker process
www      32289  0.0  0.4 1057924 73152 ?       S<   21:51   0:00  \_ nginx: worker process
www      32290  0.0  0.4 1057924 73152 ?       S<   21:51   0:00  \_ nginx: worker process
www      32291  0.0  0.4 1057924 73152 ?       S<   21:51   0:00  \_ nginx: worker process
www      32292  0.0  0.4 1057924 73152 ?       S<   21:51   0:00  \_ nginx: worker process
www      32293  0.0  0.4 1057924 73152 ?       S<   21:51   0:00  \_ nginx: worker process
www      32294  0.0  0.4 1056672 72212 ?       S    21:51   0:00  \_ nginx: cache manager process
root     32461  5.5  0.5 1056676 82316 ?       S    22:01   0:00  \_ nginx: master process /usr/local/nginx/sbin/nginx
www      32465  0.0  0.4 1057928 73052 ?       S<   22:01   0:00      \_ nginx: worker process
www      32466  0.0  0.4 1057928 73052 ?       S<   22:01   0:00      \_ nginx: worker process
www      32467  0.0  0.4 1057928 73052 ?       S<   22:01   0:00      \_ nginx: worker process
www      32468  0.0  0.4 1057928 73052 ?       S<   22:01   0:00      \_ nginx: worker process
www      32469  0.0  0.4 1057928 73052 ?       S<   22:01   0:00      \_ nginx: worker process
www      32470  0.0  0.4 1057928 73052 ?       S<   22:01   0:00      \_ nginx: worker process
www      32471  0.0  0.4 1057928 73052 ?       S<   22:01   0:00      \_ nginx: worker process
www      32472  0.0  0.4 1057928 73052 ?       S<   22:01   0:00      \_ nginx: worker process
www      32473  0.0  0.4 1057928 73052 ?       S<   22:01   0:00      \_ nginx: worker process
www      32474  0.0  0.4 1057928 73052 ?       S<   22:01   0:00      \_ nginx: worker process
www      32475  0.0  0.4 1057928 73052 ?       S<   22:01   0:00      \_ nginx: worker process
www      32476  0.0  0.4 1057928 73052 ?       S<   22:01   0:00      \_ nginx: worker process
www      32477  0.0  0.4 1056676 72176 ?       S    22:01   0:00      \_ nginx: cache manager process
www      32478  0.0  0.4 1056676 72176 ?       S    22:01   0:00      \_ nginx: cache loader process

Notice how the new master is a child of the old master.  If I send a WINCH I get:

root     32277  0.0  0.4 1056672 71868 ?       Ss   21:51   0:00 nginx: master process /usr/local/nginx/sbin/nginx
root     32461  0.2  0.5 1056676 82316 ?       S    22:01   0:00  \_ nginx: master process /usr/local/nginx/sbin/nginx
www      32465  0.0  0.4 1057928 73052 ?       S<   22:01   0:00      \_ nginx: worker process
www      32466  0.0  0.4 1057928 73052 ?       S<   22:01   0:00      \_ nginx: worker process
www      32467  0.0  0.4 1057928 73052 ?       S<   22:01   0:00      \_ nginx: worker process
www      32468  0.0  0.4 1057928 73052 ?       S<   22:01   0:00      \_ nginx: worker process
www      32469  0.0  0.4 1057928 73052 ?       S<   22:01   0:00      \_ nginx: worker process
www      32470  0.0  0.4 1057928 73052 ?       S<   22:01   0:00      \_ nginx: worker process
www      32471  0.0  0.4 1057928 73052 ?       S<   22:01   0:00      \_ nginx: worker process
www      32472  0.0  0.4 1057928 73052 ?       S<   22:01   0:00      \_ nginx: worker process
www      32473  0.0  0.4 1057928 73052 ?       S<   22:01   0:00      \_ nginx: worker process
www      32474  0.0  0.4 1057928 73052 ?       S<   22:01   0:00      \_ nginx: worker process
www      32475  0.0  0.4 1057928 73052 ?       S<   22:01   0:00      \_ nginx: worker process
www      32476  0.0  0.4 1057928 73052 ?       S<   22:01   0:00      \_ nginx: worker process
www      32477  0.0  0.4 1056676 72176 ?       S    22:01   0:00      \_ nginx: cache manager process
www      32478  0.0  0.4 1056676 72176 ?       S    22:01   0:00      \_ nginx: cache loader process

which is not what I’m looking for.  Is this a limitation when running with systemd?

Thanks,
Marc

_______________________________________________
nginx mailing list
[hidden email]
http://mailman.nginx.org/mailman/listinfo/nginx
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Binary upgrade with systemd

Marc Soda
I sent WINCH to the old master.  In this case 32277.

After sending WINCH, I can send QUIT to the old master and it exits.  Everything looks fine at that point.  But it seems a little odd to have to do this.

On Apr 4, 2017, at 4:43 AM, Lucas Rolff <[hidden email]> wrote:

Hello Marc,

For which PID do you send the WINCH signal?


From: nginx <[hidden email]> on behalf of Marc Soda <[hidden email]>
Reply-To: "[hidden email]" <[hidden email]>
Date: Tuesday, 4 April 2017 at 04.04
To: "[hidden email]" <[hidden email]>
Subject: Binary upgrade with systemd

Hello,

I’m using nginx 1.10.3 custom built on Ubuntu 16.04.  I’m also using the recommended systemd service file:

[Unit]
Description=The NGINX HTTP and reverse proxy server
After=syslog.target network.target remote-fs.target nss-lookup.target

[Service]
Type=forking
PIDFile=/run/nginx.pid
ExecStartPre=/usr/sbin/nginx -t
ExecStart=/usr/sbin/nginx
ExecReload=/bin/kill -s HUP $MAINPID
ExecStop=/bin/kill -s QUIT $MAINPID
PrivateTmp=true

[Install]
WantedBy=multi-user.target

I’m try to do a no downtime upgrade with the USR2 and WINCH signals.  Here is my process list before:

root     32277  0.0  0.4 1056672 71148 ?       Ss   21:51   0:00 nginx: master process /usr/local/nginx/sbin/nginx
www      32278  0.0  0.4 1057924 73152 ?       S<   21:51   0:00  \_ nginx: worker process
www      32279  0.0  0.4 1057924 73152 ?       S<   21:51   0:00  \_ nginx: worker process
www      32280  0.0  0.4 1057924 73152 ?       S<   21:51   0:00  \_ nginx: worker process
www      32281  0.0  0.4 1057924 73152 ?       S<   21:51   0:00  \_ nginx: worker process
www      32282  0.0  0.4 1057924 73152 ?       S<   21:51   0:00  \_ nginx: worker process
www      32283  0.0  0.4 1057924 73152 ?       S<   21:51   0:00  \_ nginx: worker process
www      32288  0.0  0.4 1057924 73152 ?       S<   21:51   0:00  \_ nginx: worker process
www      32289  0.0  0.4 1057924 73152 ?       S<   21:51   0:00  \_ nginx: worker process
www      32290  0.0  0.4 1057924 73152 ?       S<   21:51   0:00  \_ nginx: worker process
www      32291  0.0  0.4 1057924 73152 ?       S<   21:51   0:00  \_ nginx: worker process
www      32292  0.0  0.4 1057924 73152 ?       S<   21:51   0:00  \_ nginx: worker process
www      32293  0.0  0.4 1057924 73152 ?       S<   21:51   0:00  \_ nginx: worker process
www      32294  0.0  0.4 1056672 72212 ?       S    21:51   0:00  \_ nginx: cache manager process

and here it is after sending USR2:

root     32277  0.0  0.4 1056672 71868 ?       Ss   21:51   0:00 nginx: master process /usr/local/nginx/sbin/nginx
www      32278  0.0  0.4 1057924 73152 ?       S<   21:51   0:00  \_ nginx: worker process
www      32279  0.0  0.4 1057924 73152 ?       S<   21:51   0:00  \_ nginx: worker process
www      32280  0.0  0.4 1057924 73152 ?       S<   21:51   0:00  \_ nginx: worker process
www      32281  0.0  0.4 1057924 73152 ?       S<   21:51   0:00  \_ nginx: worker process
www      32282  0.0  0.4 1057924 73152 ?       S<   21:51   0:00  \_ nginx: worker process
www      32283  0.0  0.4 1057924 73152 ?       S<   21:51   0:00  \_ nginx: worker process
www      32288  0.0  0.4 1057924 73152 ?       S<   21:51   0:00  \_ nginx: worker process
www      32289  0.0  0.4 1057924 73152 ?       S<   21:51   0:00  \_ nginx: worker process
www      32290  0.0  0.4 1057924 73152 ?       S<   21:51   0:00  \_ nginx: worker process
www      32291  0.0  0.4 1057924 73152 ?       S<   21:51   0:00  \_ nginx: worker process
www      32292  0.0  0.4 1057924 73152 ?       S<   21:51   0:00  \_ nginx: worker process
www      32293  0.0  0.4 1057924 73152 ?       S<   21:51   0:00  \_ nginx: worker process
www      32294  0.0  0.4 1056672 72212 ?       S    21:51   0:00  \_ nginx: cache manager process
root     32461  5.5  0.5 1056676 82316 ?       S    22:01   0:00  \_ nginx: master process /usr/local/nginx/sbin/nginx
www      32465  0.0  0.4 1057928 73052 ?       S<   22:01   0:00      \_ nginx: worker process
www      32466  0.0  0.4 1057928 73052 ?       S<   22:01   0:00      \_ nginx: worker process
www      32467  0.0  0.4 1057928 73052 ?       S<   22:01   0:00      \_ nginx: worker process
www      32468  0.0  0.4 1057928 73052 ?       S<   22:01   0:00      \_ nginx: worker process
www      32469  0.0  0.4 1057928 73052 ?       S<   22:01   0:00      \_ nginx: worker process
www      32470  0.0  0.4 1057928 73052 ?       S<   22:01   0:00      \_ nginx: worker process
www      32471  0.0  0.4 1057928 73052 ?       S<   22:01   0:00      \_ nginx: worker process
www      32472  0.0  0.4 1057928 73052 ?       S<   22:01   0:00      \_ nginx: worker process
www      32473  0.0  0.4 1057928 73052 ?       S<   22:01   0:00      \_ nginx: worker process
www      32474  0.0  0.4 1057928 73052 ?       S<   22:01   0:00      \_ nginx: worker process
www      32475  0.0  0.4 1057928 73052 ?       S<   22:01   0:00      \_ nginx: worker process
www      32476  0.0  0.4 1057928 73052 ?       S<   22:01   0:00      \_ nginx: worker process
www      32477  0.0  0.4 1056676 72176 ?       S    22:01   0:00      \_ nginx: cache manager process
www      32478  0.0  0.4 1056676 72176 ?       S    22:01   0:00      \_ nginx: cache loader process

Notice how the new master is a child of the old master.  If I send a WINCH I get:

root     32277  0.0  0.4 1056672 71868 ?       Ss   21:51   0:00 nginx: master process /usr/local/nginx/sbin/nginx
root     32461  0.2  0.5 1056676 82316 ?       S    22:01   0:00  \_ nginx: master process /usr/local/nginx/sbin/nginx
www      32465  0.0  0.4 1057928 73052 ?       S<   22:01   0:00      \_ nginx: worker process
www      32466  0.0  0.4 1057928 73052 ?       S<   22:01   0:00      \_ nginx: worker process
www      32467  0.0  0.4 1057928 73052 ?       S<   22:01   0:00      \_ nginx: worker process
www      32468  0.0  0.4 1057928 73052 ?       S<   22:01   0:00      \_ nginx: worker process
www      32469  0.0  0.4 1057928 73052 ?       S<   22:01   0:00      \_ nginx: worker process
www      32470  0.0  0.4 1057928 73052 ?       S<   22:01   0:00      \_ nginx: worker process
www      32471  0.0  0.4 1057928 73052 ?       S<   22:01   0:00      \_ nginx: worker process
www      32472  0.0  0.4 1057928 73052 ?       S<   22:01   0:00      \_ nginx: worker process
www      32473  0.0  0.4 1057928 73052 ?       S<   22:01   0:00      \_ nginx: worker process
www      32474  0.0  0.4 1057928 73052 ?       S<   22:01   0:00      \_ nginx: worker process
www      32475  0.0  0.4 1057928 73052 ?       S<   22:01   0:00      \_ nginx: worker process
www      32476  0.0  0.4 1057928 73052 ?       S<   22:01   0:00      \_ nginx: worker process
www      32477  0.0  0.4 1056676 72176 ?       S    22:01   0:00      \_ nginx: cache manager process
www      32478  0.0  0.4 1056676 72176 ?       S    22:01   0:00      \_ nginx: cache loader process

which is not what I’m looking for.  Is this a limitation when running with systemd?

Thanks,
Marc
_______________________________________________
nginx mailing list
[hidden email]
http://mailman.nginx.org/mailman/listinfo/nginx


_______________________________________________
nginx mailing list
[hidden email]
http://mailman.nginx.org/mailman/listinfo/nginx
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Binary upgrade with systemd

Lucas Rolff
According to the documentation: http://nginx.org/en/docs/control.html#upgrade

You'd have to send the QUIT signal to finish off upgrading (replacing) the binary during runtime.

Marc Soda wrote:
I sent WINCH to the old master.  In this case 32277.

After sending WINCH, I can send QUIT to the old master and it exits.  Everything looks fine at that point.  But it seems a little odd to have to do this.

On Apr 4, 2017, at 4:43 AM, Lucas Rolff <[hidden email]> wrote:

Hello Marc,

For which PID do you send the WINCH signal?


From: nginx <[hidden email]> on behalf of Marc Soda <[hidden email]>
Reply-To: "[hidden email]" <[hidden email]>
Date: Tuesday, 4 April 2017 at 04.04
To: "[hidden email]" <[hidden email]>
Subject: Binary upgrade with systemd

Hello,

I’m using nginx 1.10.3 custom built on Ubuntu 16.04.  I’m also using the recommended systemd service file:

[Unit]
Description=The NGINX HTTP and reverse proxy server
After=syslog.target network.target remote-fs.target nss-lookup.target

[Service]
Type=forking
PIDFile=/run/nginx.pid
ExecStartPre=/usr/sbin/nginx -t
ExecStart=/usr/sbin/nginx
ExecReload=/bin/kill -s HUP $MAINPID
ExecStop=/bin/kill -s QUIT $MAINPID
PrivateTmp=true

[Install]
WantedBy=multi-user.target

I’m try to do a no downtime upgrade with the USR2 and WINCH signals.  Here is my process list before:

root     32277  0.0  0.4 1056672 71148 ?       Ss   21:51   0:00 nginx: master process /usr/local/nginx/sbin/nginx
www      32278  0.0  0.4 1057924 73152 ?       S<   21:51   0:00  \_ nginx: worker process
www      32279  0.0  0.4 1057924 73152 ?       S<   21:51   0:00  \_ nginx: worker process
www      32280  0.0  0.4 1057924 73152 ?       S<   21:51   0:00  \_ nginx: worker process
www      32281  0.0  0.4 1057924 73152 ?       S<   21:51   0:00  \_ nginx: worker process
www      32282  0.0  0.4 1057924 73152 ?       S<   21:51   0:00  \_ nginx: worker process
www      32283  0.0  0.4 1057924 73152 ?       S<   21:51   0:00  \_ nginx: worker process
www      32288  0.0  0.4 1057924 73152 ?       S<   21:51   0:00  \_ nginx: worker process
www      32289  0.0  0.4 1057924 73152 ?       S<   21:51   0:00  \_ nginx: worker process
www      32290  0.0  0.4 1057924 73152 ?       S<   21:51   0:00  \_ nginx: worker process
www      32291  0.0  0.4 1057924 73152 ?       S<   21:51   0:00  \_ nginx: worker process
www      32292  0.0  0.4 1057924 73152 ?       S<   21:51   0:00  \_ nginx: worker process
www      32293  0.0  0.4 1057924 73152 ?       S<   21:51   0:00  \_ nginx: worker process
www      32294  0.0  0.4 1056672 72212 ?       S    21:51   0:00  \_ nginx: cache manager process

and here it is after sending USR2:

root     32277  0.0  0.4 1056672 71868 ?       Ss   21:51   0:00 nginx: master process /usr/local/nginx/sbin/nginx
www      32278  0.0  0.4 1057924 73152 ?       S<   21:51   0:00  \_ nginx: worker process
www      32279  0.0  0.4 1057924 73152 ?       S<   21:51   0:00  \_ nginx: worker process
www      32280  0.0  0.4 1057924 73152 ?       S<   21:51   0:00  \_ nginx: worker process
www      32281  0.0  0.4 1057924 73152 ?       S<   21:51   0:00  \_ nginx: worker process
www      32282  0.0  0.4 1057924 73152 ?       S<   21:51   0:00  \_ nginx: worker process
www      32283  0.0  0.4 1057924 73152 ?       S<   21:51   0:00  \_ nginx: worker process
www      32288  0.0  0.4 1057924 73152 ?       S<   21:51   0:00  \_ nginx: worker process
www      32289  0.0  0.4 1057924 73152 ?       S<   21:51   0:00  \_ nginx: worker process
www      32290  0.0  0.4 1057924 73152 ?       S<   21:51   0:00  \_ nginx: worker process
www      32291  0.0  0.4 1057924 73152 ?       S<   21:51   0:00  \_ nginx: worker process
www      32292  0.0  0.4 1057924 73152 ?       S<   21:51   0:00  \_ nginx: worker process
www      32293  0.0  0.4 1057924 73152 ?       S<   21:51   0:00  \_ nginx: worker process
www      32294  0.0  0.4 1056672 72212 ?       S    21:51   0:00  \_ nginx: cache manager process
root     32461  5.5  0.5 1056676 82316 ?       S    22:01   0:00  \_ nginx: master process /usr/local/nginx/sbin/nginx
www      32465  0.0  0.4 1057928 73052 ?       S<   22:01   0:00      \_ nginx: worker process
www      32466  0.0  0.4 1057928 73052 ?       S<   22:01   0:00      \_ nginx: worker process
www      32467  0.0  0.4 1057928 73052 ?       S<   22:01   0:00      \_ nginx: worker process
www      32468  0.0  0.4 1057928 73052 ?       S<   22:01   0:00      \_ nginx: worker process
www      32469  0.0  0.4 1057928 73052 ?       S<   22:01   0:00      \_ nginx: worker process
www      32470  0.0  0.4 1057928 73052 ?       S<   22:01   0:00      \_ nginx: worker process
www      32471  0.0  0.4 1057928 73052 ?       S<   22:01   0:00      \_ nginx: worker process
www      32472  0.0  0.4 1057928 73052 ?       S<   22:01   0:00      \_ nginx: worker process
www      32473  0.0  0.4 1057928 73052 ?       S<   22:01   0:00      \_ nginx: worker process
www      32474  0.0  0.4 1057928 73052 ?       S<   22:01   0:00      \_ nginx: worker process
www      32475  0.0  0.4 1057928 73052 ?       S<   22:01   0:00      \_ nginx: worker process
www      32476  0.0  0.4 1057928 73052 ?       S<   22:01   0:00      \_ nginx: worker process
www      32477  0.0  0.4 1056676 72176 ?       S    22:01   0:00      \_ nginx: cache manager process
www      32478  0.0  0.4 1056676 72176 ?       S    22:01   0:00      \_ nginx: cache loader process

Notice how the new master is a child of the old master.  If I send a WINCH I get:

root     32277  0.0  0.4 1056672 71868 ?       Ss   21:51   0:00 nginx: master process /usr/local/nginx/sbin/nginx
root     32461  0.2  0.5 1056676 82316 ?       S    22:01   0:00  \_ nginx: master process /usr/local/nginx/sbin/nginx
www      32465  0.0  0.4 1057928 73052 ?       S<   22:01   0:00      \_ nginx: worker process
www      32466  0.0  0.4 1057928 73052 ?       S<   22:01   0:00      \_ nginx: worker process
www      32467  0.0  0.4 1057928 73052 ?       S<   22:01   0:00      \_ nginx: worker process
www      32468  0.0  0.4 1057928 73052 ?       S<   22:01   0:00      \_ nginx: worker process
www      32469  0.0  0.4 1057928 73052 ?       S<   22:01   0:00      \_ nginx: worker process
www      32470  0.0  0.4 1057928 73052 ?       S<   22:01   0:00      \_ nginx: worker process
www      32471  0.0  0.4 1057928 73052 ?       S<   22:01   0:00      \_ nginx: worker process
www      32472  0.0  0.4 1057928 73052 ?       S<   22:01   0:00      \_ nginx: worker process
www      32473  0.0  0.4 1057928 73052 ?       S<   22:01   0:00      \_ nginx: worker process
www      32474  0.0  0.4 1057928 73052 ?       S<   22:01   0:00      \_ nginx: worker process
www      32475  0.0  0.4 1057928 73052 ?       S<   22:01   0:00      \_ nginx: worker process
www      32476  0.0  0.4 1057928 73052 ?       S<   22:01   0:00      \_ nginx: worker process
www      32477  0.0  0.4 1056676 72176 ?       S    22:01   0:00      \_ nginx: cache manager process
www      32478  0.0  0.4 1056676 72176 ?       S    22:01   0:00      \_ nginx: cache loader process

which is not what I’m looking for.  Is this a limitation when running with systemd?

Thanks,
Marc
_______________________________________________
nginx mailing list
[hidden email]
http://mailman.nginx.org/mailman/listinfo/nginx

_______________________________________________
nginx mailing list
[hidden email]
http://mailman.nginx.org/mailman/listinfo/nginx


_______________________________________________
nginx mailing list
[hidden email]
http://mailman.nginx.org/mailman/listinfo/nginx
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Binary upgrade with systemd

Marc Soda
In reply to this post by Marc Soda
It seems that it’s working as designed.  I thought the old master would exit automatically.  But it sticks around in case you want to fail back.

Thanks and sorry for the noise.


On Apr 4, 2017, at 7:41 AM, Marc Soda <[hidden email]> wrote:

I sent WINCH to the old master.  In this case 32277.

After sending WINCH, I can send QUIT to the old master and it exits.  Everything looks fine at that point.  But it seems a little odd to have to do this.

On Apr 4, 2017, at 4:43 AM, Lucas Rolff <[hidden email]> wrote:

Hello Marc,

For which PID do you send the WINCH signal?


From: nginx <[hidden email]> on behalf of Marc Soda <[hidden email]>
Reply-To: "[hidden email]" <[hidden email]>
Date: Tuesday, 4 April 2017 at 04.04
To: "[hidden email]" <[hidden email]>
Subject: Binary upgrade with systemd

Hello,

I’m using nginx 1.10.3 custom built on Ubuntu 16.04.  I’m also using the recommended systemd service file:

[Unit]
Description=The NGINX HTTP and reverse proxy server
After=syslog.target network.target remote-fs.target nss-lookup.target

[Service]
Type=forking
PIDFile=/run/nginx.pid
ExecStartPre=/usr/sbin/nginx -t
ExecStart=/usr/sbin/nginx
ExecReload=/bin/kill -s HUP $MAINPID
ExecStop=/bin/kill -s QUIT $MAINPID
PrivateTmp=true

[Install]
WantedBy=multi-user.target

I’m try to do a no downtime upgrade with the USR2 and WINCH signals.  Here is my process list before:

root     32277  0.0  0.4 1056672 71148 ?       Ss   21:51   0:00 nginx: master process /usr/local/nginx/sbin/nginx
www      32278  0.0  0.4 1057924 73152 ?       S<   21:51   0:00  \_ nginx: worker process
www      32279  0.0  0.4 1057924 73152 ?       S<   21:51   0:00  \_ nginx: worker process
www      32280  0.0  0.4 1057924 73152 ?       S<   21:51   0:00  \_ nginx: worker process
www      32281  0.0  0.4 1057924 73152 ?       S<   21:51   0:00  \_ nginx: worker process
www      32282  0.0  0.4 1057924 73152 ?       S<   21:51   0:00  \_ nginx: worker process
www      32283  0.0  0.4 1057924 73152 ?       S<   21:51   0:00  \_ nginx: worker process
www      32288  0.0  0.4 1057924 73152 ?       S<   21:51   0:00  \_ nginx: worker process
www      32289  0.0  0.4 1057924 73152 ?       S<   21:51   0:00  \_ nginx: worker process
www      32290  0.0  0.4 1057924 73152 ?       S<   21:51   0:00  \_ nginx: worker process
www      32291  0.0  0.4 1057924 73152 ?       S<   21:51   0:00  \_ nginx: worker process
www      32292  0.0  0.4 1057924 73152 ?       S<   21:51   0:00  \_ nginx: worker process
www      32293  0.0  0.4 1057924 73152 ?       S<   21:51   0:00  \_ nginx: worker process
www      32294  0.0  0.4 1056672 72212 ?       S    21:51   0:00  \_ nginx: cache manager process

and here it is after sending USR2:

root     32277  0.0  0.4 1056672 71868 ?       Ss   21:51   0:00 nginx: master process /usr/local/nginx/sbin/nginx
www      32278  0.0  0.4 1057924 73152 ?       S<   21:51   0:00  \_ nginx: worker process
www      32279  0.0  0.4 1057924 73152 ?       S<   21:51   0:00  \_ nginx: worker process
www      32280  0.0  0.4 1057924 73152 ?       S<   21:51   0:00  \_ nginx: worker process
www      32281  0.0  0.4 1057924 73152 ?       S<   21:51   0:00  \_ nginx: worker process
www      32282  0.0  0.4 1057924 73152 ?       S<   21:51   0:00  \_ nginx: worker process
www      32283  0.0  0.4 1057924 73152 ?       S<   21:51   0:00  \_ nginx: worker process
www      32288  0.0  0.4 1057924 73152 ?       S<   21:51   0:00  \_ nginx: worker process
www      32289  0.0  0.4 1057924 73152 ?       S<   21:51   0:00  \_ nginx: worker process
www      32290  0.0  0.4 1057924 73152 ?       S<   21:51   0:00  \_ nginx: worker process
www      32291  0.0  0.4 1057924 73152 ?       S<   21:51   0:00  \_ nginx: worker process
www      32292  0.0  0.4 1057924 73152 ?       S<   21:51   0:00  \_ nginx: worker process
www      32293  0.0  0.4 1057924 73152 ?       S<   21:51   0:00  \_ nginx: worker process
www      32294  0.0  0.4 1056672 72212 ?       S    21:51   0:00  \_ nginx: cache manager process
root     32461  5.5  0.5 1056676 82316 ?       S    22:01   0:00  \_ nginx: master process /usr/local/nginx/sbin/nginx
www      32465  0.0  0.4 1057928 73052 ?       S<   22:01   0:00      \_ nginx: worker process
www      32466  0.0  0.4 1057928 73052 ?       S<   22:01   0:00      \_ nginx: worker process
www      32467  0.0  0.4 1057928 73052 ?       S<   22:01   0:00      \_ nginx: worker process
www      32468  0.0  0.4 1057928 73052 ?       S<   22:01   0:00      \_ nginx: worker process
www      32469  0.0  0.4 1057928 73052 ?       S<   22:01   0:00      \_ nginx: worker process
www      32470  0.0  0.4 1057928 73052 ?       S<   22:01   0:00      \_ nginx: worker process
www      32471  0.0  0.4 1057928 73052 ?       S<   22:01   0:00      \_ nginx: worker process
www      32472  0.0  0.4 1057928 73052 ?       S<   22:01   0:00      \_ nginx: worker process
www      32473  0.0  0.4 1057928 73052 ?       S<   22:01   0:00      \_ nginx: worker process
www      32474  0.0  0.4 1057928 73052 ?       S<   22:01   0:00      \_ nginx: worker process
www      32475  0.0  0.4 1057928 73052 ?       S<   22:01   0:00      \_ nginx: worker process
www      32476  0.0  0.4 1057928 73052 ?       S<   22:01   0:00      \_ nginx: worker process
www      32477  0.0  0.4 1056676 72176 ?       S    22:01   0:00      \_ nginx: cache manager process
www      32478  0.0  0.4 1056676 72176 ?       S    22:01   0:00      \_ nginx: cache loader process

Notice how the new master is a child of the old master.  If I send a WINCH I get:

root     32277  0.0  0.4 1056672 71868 ?       Ss   21:51   0:00 nginx: master process /usr/local/nginx/sbin/nginx
root     32461  0.2  0.5 1056676 82316 ?       S    22:01   0:00  \_ nginx: master process /usr/local/nginx/sbin/nginx
www      32465  0.0  0.4 1057928 73052 ?       S<   22:01   0:00      \_ nginx: worker process
www      32466  0.0  0.4 1057928 73052 ?       S<   22:01   0:00      \_ nginx: worker process
www      32467  0.0  0.4 1057928 73052 ?       S<   22:01   0:00      \_ nginx: worker process
www      32468  0.0  0.4 1057928 73052 ?       S<   22:01   0:00      \_ nginx: worker process
www      32469  0.0  0.4 1057928 73052 ?       S<   22:01   0:00      \_ nginx: worker process
www      32470  0.0  0.4 1057928 73052 ?       S<   22:01   0:00      \_ nginx: worker process
www      32471  0.0  0.4 1057928 73052 ?       S<   22:01   0:00      \_ nginx: worker process
www      32472  0.0  0.4 1057928 73052 ?       S<   22:01   0:00      \_ nginx: worker process
www      32473  0.0  0.4 1057928 73052 ?       S<   22:01   0:00      \_ nginx: worker process
www      32474  0.0  0.4 1057928 73052 ?       S<   22:01   0:00      \_ nginx: worker process
www      32475  0.0  0.4 1057928 73052 ?       S<   22:01   0:00      \_ nginx: worker process
www      32476  0.0  0.4 1057928 73052 ?       S<   22:01   0:00      \_ nginx: worker process
www      32477  0.0  0.4 1056676 72176 ?       S    22:01   0:00      \_ nginx: cache manager process
www      32478  0.0  0.4 1056676 72176 ?       S    22:01   0:00      \_ nginx: cache loader process

which is not what I’m looking for.  Is this a limitation when running with systemd?

Thanks,
Marc
_______________________________________________
nginx mailing list
[hidden email]
http://mailman.nginx.org/mailman/listinfo/nginx

_______________________________________________
nginx mailing list
[hidden email]
http://mailman.nginx.org/mailman/listinfo/nginx


_______________________________________________
nginx mailing list
[hidden email]
http://mailman.nginx.org/mailman/listinfo/nginx
Loading...