haifeng9414 opened a new issue #2186:
URL: https://github.com/apache/apisix/issues/2186
### Issue description
The http_init method starts a privileged process and the privileged process
initializes the routing in the init_worker phase
```
-- radixtree_uri.lua file
function _M.init_worker(filter)
local err
user_routes, err = core.config.new("/routes", {
automatic = true,
item_schema = core.schema.route,
filter = filter,
})
if not user_routes then
error("failed to create etcd instance for fetching /routes : " ..
err)
end
end
```
When setting `config_center` to `yaml` in `config.yaml`, the created object
will add a timer and continuously sync yaml data, but the init_worker method
skips the privileged process
```
-- config_yaml.lua
function _M.init_worker()
if process.type() ~= "worker" and process.type() ~= "single" then
return
end
read_apisix_yaml()
ngx.timer.every(1, read_apisix_yaml)
end
```
This will cause the sync to fail and keep printing error logs
```
if not apisix_yaml_ctime then
log.warn("wait for more time")
return nil, "failed to read local file " .. apisix_yaml_path
end
```
### Environment
* apisix version (cmd: `apisix version`): The latest master code
* OS: Mac OS
### Minimal test code / Steps to reproduce the issue
1. set `config_center` to `yaml`
### What's the actual result? (including assertion message & call stack if
applicable)
The log keeps printing "wait for more time, context: ngx.timer"
### What's the expected result?
no error
I think the privileged process should skip the init_worker method of some
modules
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]