ywave620 opened a new issue, #13087:
URL: https://github.com/apache/apisix/issues/13087

   ### Current Behavior
   
    
   the hot reload is vulnerable to two issues
   
   1. **Incomplete state if `init()`/`destroy()` throw**: `apisix/plugin.lua` 
calls   `destroy()` then `init()` on each plugin synchronously during reload. 
If any of these throws,
      some plugins are destroyed but not restarted, leaving `plugin.plugins` in 
a permanently
      inconsistent mixed old/new state.
   
   2. **Requests served with incomplete plugin set during reload**: When 
`plugin.lua` `require()`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 
through `plugin.plugins`
      while 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


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to