[nginx] Introduced worker_shutdown_timeout.
mdounin at mdounin.ru
Thu Mar 9 12:29:35 UTC 2017
On Thu, Mar 09, 2017 at 02:39:26PM +0800, 洪志道 wrote:
> "Cancelable timers are now preserved if there are other timers. There is no
> need to cancel timers early if there are other timers blocking shutdown
> anyway. Preserving such timers allows nginx to continue some periodic work
> till the shutdown is actually possible. With the new approach, timers with
> ev->cancelable are simply ignored when checking if there are any timers
> left during shutdown."
> But how to do the timers those are cancelable such as buffer-event in log
> When the worker process is shutting down, they lose the chance to do
> registered handler.
> Even so the log module also works well because of 'ngx_conf_flush_files'.
Cancelable timers are expected to do it's work normally until the
actual shutdown is possible, but will not delay shutdown.
You can't relay on them to do any cleanup work though, as they
will not be called in many cases. For example, much like any
other timers they will not be called on fast shutdown (aka
ngx_terminate). To do a cleanup work you should use cleanup
handlers and/or exit_process callbacks.
In particular, the log module uses cancelable timers to do
periodic flushes while the process is still running. The final
flush will be done on the process exit in the
ngx_conf_flush_files() exit_process callback.
More information about the nginx-devel