bug: the hot reload procedure is not robust
Current Behavior
the hot reload is vulnerable to two issues
Incomplete state if
init()/destroy()throw:apisix/plugin.luacallsdestroy()theninit()on each plugin synchronously during reload. If any of these throws, some plugins are destroyed but not restarted, leavingplugin.pluginsin a permanently inconsistent mixed old/new state.Requests served with incomplete plugin set during reload: When
plugin.luarequire()s a new plugin module, if that module's top-level code yields (cosocket,ngx.sleep), the nginx scheduler resumes other coroutines. An incoming request can then run throughplugin.pluginswhile it only contains the subset of plugins reloaded so far — a partial, inconsistent plugin set processes live traffic.
Expected Behavior
atomic switch to new plugins and then tear down old plugins this require careful design
Error Logs
none
Steps to Reproduce
none
Environment
does not matter
Source: apache/apisix