[nginx] Introduced worker_shutdown_timeout.
hongzhidao at gmail.com
Thu Mar 9 13:00:43 UTC 2017
We can close the topic.
I review the previous infos, and I have already got the answer.
2017-03-09 20:53 GMT+08:00 洪志道 <hongzhidao at gmail.com>:
> "First of all, we can set timeout zero if need to exit immediately."
> It's not a good idea.
> 2017-03-09 20:52 GMT+08:00 洪志道 <hongzhidao at gmail.com>:
>> I get it.
>> Yep, we can do the cleanup work in exit process or pool cleanup when
>> expired time happened.
>> I keep my opinion that it's useful and helpful if we set *ngx_shutdown_event.cancelable
>> = 0.*
>> First of all, we can set timeout zero if need to exit immediately.
>> The key point is whether we need to invoke event handler
>> like ngx_http_log_flush_handler.
>> And I think it's more convenient to do the consequent things,
>> we still have the event information in event handler, but not sure in
>> exit process phase.
>> By the way, is it a problem if I try to set *ngx_shutdown_event.cancelable
>> = 0.*
>> Thanks again.
>> 2017-03-09 20:29 GMT+08:00 Maxim Dounin <mdounin at mdounin.ru>:
>>> 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
>>> > till the shutdown is actually possible. With the new approach, timers
>>> > 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
>>> > module.
>>> > 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
>>> 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.
>>> Maxim Dounin
>>> nginx-devel mailing list
>>> nginx-devel at nginx.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the nginx-devel