<div dir="ltr">Hello,<div>Thanks for the suggestion, "worker_shutdown_timeout" is good for me.</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Maxim Dounin <<a href="mailto:mdounin@mdounin.ru">mdounin@mdounin.ru</a>> 于2022年12月20日周二 16:04写道:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hello!<br>
<br>
On Tue, Dec 20, 2022 at 03:01:59PM +0800, 乔志奇 wrote:<br>
<br>
> # HG changeset patch<br>
> # User 乔志奇@Matebook-Qiao <<a href="mailto:qiaozhiqi2016@gmail.com" target="_blank">qiaozhiqi2016@gmail.com</a>><br>
> # Date 1671515941 -28800<br>
> #      Tue Dec 20 13:59:01 2022 +0800<br>
> # Branch nginx-bugfix-websocket<br>
> # Node ID 3e68435db4a9991921b5bf91d792787a1ad387fb<br>
> # Parent  3108d4d668e4b907868b815f0441d4c893bf4188<br>
> Fixed state protection when restarting during the websocket request process<br>
> <br>
> During the websocket request process, it is necessary to add a timer<br>
> operation, but we need to do state protection for the timer addition<br>
> operation. When the nginx process is restarted or stopped, the timer should<br>
> be prohibited from being added, otherwise continuous websocket requests<br>
> will cause the old process to be unable to exit during the restart process<br>
> or unable to exit during the stop process.<br>
<br>
Thanks, but no.<br>
<br>
The graceful exit process is expected to handle all existing <br>
connections till they are closed normally.  This includes <br>
Websocket connections.<br>
<br>
The recommended approach for long-running connections (including <br>
Websocket, stream module connections, or just long-running HTTP <br>
requests) is to close them periodically from the server side, so <br>
they can be properly re-established without errors.<br>
<br>
If this does not work for you for some reason (for example, if you <br>
cannot control the behaviour of the backend server), consider <br>
using the "worker_shutdown_timeout" directive<br>
(<a href="http://nginx.org/r/worker_shutdown_timeout" rel="noreferrer" target="_blank">http://nginx.org/r/worker_shutdown_timeout</a>) to terminate all <br>
connections after certain period of time. <br>
<br>
-- <br>
Maxim Dounin<br>
<a href="http://mdounin.ru/" rel="noreferrer" target="_blank">http://mdounin.ru/</a><br>
_______________________________________________<br>
nginx-devel mailing list<br>
<a href="mailto:nginx-devel@nginx.org" target="_blank">nginx-devel@nginx.org</a><br>
<a href="https://mailman.nginx.org/mailman/listinfo/nginx-devel" rel="noreferrer" target="_blank">https://mailman.nginx.org/mailman/listinfo/nginx-devel</a><br>
</blockquote></div>