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 <mdou...@mdounin.ru>: > Hello! > > 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 > > 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 '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. > > -- > Maxim Dounin > http://nginx.org/ > _______________________________________________ > nginx-devel mailing list > nginx-devel@nginx.org > http://mailman.nginx.org/mailman/listinfo/nginx-devel >
_______________________________________________ nginx-devel mailing list nginx-devel@nginx.org http://mailman.nginx.org/mailman/listinfo/nginx-devel