[PATCH] Fixed state protection when restarting during the websocket request process

乔志奇 qiaozhiqi2016 at gmail.com
Mon Dec 26 07:02:04 UTC 2022


Hello,
Thanks for the suggestion, "worker_shutdown_timeout" is good for me.

Maxim Dounin <mdounin at mdounin.ru> 于2022年12月20日周二 16:04写道:

> Hello!
>
> On Tue, Dec 20, 2022 at 03:01:59PM +0800, 乔志奇 wrote:
>
> > # HG changeset patch
> > # User 乔志奇@Matebook-Qiao <qiaozhiqi2016 at gmail.com>
> > # Date 1671515941 -28800
> > #      Tue Dec 20 13:59:01 2022 +0800
> > # Branch nginx-bugfix-websocket
> > # Node ID 3e68435db4a9991921b5bf91d792787a1ad387fb
> > # Parent  3108d4d668e4b907868b815f0441d4c893bf4188
> > Fixed state protection when restarting during the websocket request
> process
> >
> > During the websocket request process, it is necessary to add a timer
> > operation, but we need to do state protection for the timer addition
> > operation. When the nginx process is restarted or stopped, the timer
> should
> > be prohibited from being added, otherwise continuous websocket requests
> > will cause the old process to be unable to exit during the restart
> process
> > or unable to exit during the stop process.
>
> Thanks, but no.
>
> The graceful exit process is expected to handle all existing
> connections till they are closed normally.  This includes
> Websocket connections.
>
> The recommended approach for long-running connections (including
> Websocket, stream module connections, or just long-running HTTP
> requests) is to close them periodically from the server side, so
> they can be properly re-established without errors.
>
> If this does not work for you for some reason (for example, if you
> cannot control the behaviour of the backend server), consider
> using the "worker_shutdown_timeout" directive
> (http://nginx.org/r/worker_shutdown_timeout) to terminate all
> connections after certain period of time.
>
> --
> Maxim Dounin
> http://mdounin.ru/
> _______________________________________________
> nginx-devel mailing list
> nginx-devel at nginx.org
> https://mailman.nginx.org/mailman/listinfo/nginx-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx-devel/attachments/20221226/8d7cff9a/attachment-0001.htm>


More information about the nginx-devel mailing list