<div dir="ltr">Hello<div><br></div><div>I understand that sending signals is async so there is no guarantee that QUIT is not processed before USR2 so nginx receiving QUIT will ignore USR2 if received after QUIT.</div><div>I think of a faster solution still being safe</div><div><br></div><div>kill -USR2 $nginxPid</div><div><b>ADDED: wait until nginx pid file has a content different than $nginxPid</b></div><div>kill -WINCH $nginxPid<br></div>kill -QUIT $nginxPid<div><br></div><div>so that if nginx pid file content has changed it means a new master was spawned.</div><div><br></div><div>I have a question then: does nginx master writes its pid to the file only after having spawned workers, or could it be a small amount of time where a pid file will exist with a new content while only master is alive and workers are not spawned yet? In that case it would mean i still need to wait a bit, probably by ensuring there is at least 1 worker process alive with ppid the pid of the new master.</div><div><br></div><div>best regards,</div><div><br></div><div>Sébastien</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Le mar. 16 juil. 2024 à 17:08, Sébastien Rebecchi <<a href="mailto:srebecchi@kameleoon.com" target="_blank">srebecchi@kameleoon.com</a>> a écrit :<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Hello<div><br><div>Reading this doc seems unclear to me <a href="https://nginx.org/en/docs/control.html#upgrade" target="_blank">https://nginx.org/en/docs/control.html#upgrade</a></div><div><br></div><div>According to it, we should do</div><div><br></div><div>kill -USR2 $nginxPid<br> kill -WINCH $nginxPid<br>kill -QUIT $nginxPid<br></div><div><br></div><div>with $nginxPid the pid of the old nginx.</div><div><br></div><div>But doing that seems not good cause we have a strange behaviour that old nginx worker processes are shutting down but no new master and workers are spawned</div><div><br></div><div>If I add a sleep time before sending the QUIT signal then all is good, for ex sleep 20; between the WINCH and QUIT.</div><div><br></div><div>How to explain that? It seems nginx receiving QUIT before processing the USR2 ignored messages received before and just ignores it? Or what is the explanation? And how to solve that properly cause sleeping seems not a clean workaround. I need an automatic procedure, not to have to manually look at what happens on all my servers during upgrade.</div><div><br></div><div>Best regards,</div><div><br></div><div>Sébastien.</div></div><div><br></div></div>
</blockquote></div>