lua-resty-acme icon indicating copy to clipboard operation
lua-resty-acme copied to clipboard

check_renew() function is run whenever the nginx workers are reloaded

Open nizar-m opened this issue 4 years ago • 3 comments

Executing systemctl reload openresty is resulting in the check_renew() function in autossl being run before the old workers are killed. This could be a problem if the reload has to executed quite often.

nizar-m avatar Dec 22 '21 13:12 nizar-m

@nizar-m The check_new function is called in a timer for configured renew_check_interval, meaning new worker will wait to renew_check_interval time to actually do the renew.

fffonion avatar Dec 22 '21 13:12 fffonion

This is not the new worker executing the check_new function, rather the old worker executing it, before it is stopped.

This happens only on reload. On restart, the workers are force closed.

nizar-m avatar Dec 22 '21 14:12 nizar-m

I wonder this could be because the timer gets called prematurely on worker shutdown: https://github.com/openresty/lua-nginx-module#ngxtimerat

This is explained in the documentation for ngx.timer.at, although the premature expiry is applicable for ngx.timer.every as well.

nizar-m avatar Dec 22 '21 14:12 nizar-m