You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by GitBox <gi...@apache.org> on 2021/09/01 00:44:41 UTC

[GitHub] [apisix] rztao opened a new issue #4949: bug: The logic for method fetch_full_registry in nacos.lua will break the loop if the previous get_url request failed

rztao opened a new issue #4949:
URL: https://github.com/apache/apisix/issues/4949


   ### Issue description
   
   The logic for method fetch_full_registry in nacos.lua will break the loop if the previous get_url request failed.  This issue can be reproduced with  a wrong route with service discovery configuration. 
   
   `
   ```lua
   local data, err
       for _, service_info in ipairs(infos) do
           local namespace_param = get_namespace_param(service_info.namespace_id)
           local group_name_param = get_group_name_param(service_info.group_name)
           data, err = get_url(base_uri, instance_list_path .. service_info.service_name
                               .. token_param .. namespace_param .. group_name_param)
           if err then
               log.error('get_url:', instance_list_path, ' err:', err)
               if not applications then
                   applications = up_apps
               end
               return
           end
   
           for _, host in ipairs(data.hosts) do
               local nodes = up_apps[service_info.service_name]
               if not nodes then
                   nodes = {}
                   up_apps[service_info.service_name] = nodes
               end
               core.table.insert(nodes, {
                   host = host.ip,
                   port = host.port,
                   weight = host.weight or default_weight,
               })
           end
       end
   ````
   
   ### Environment
   
   - apisix version (cmd: `apisix version`):  2.9
   - OS (cmd: `uname -a`):  MacOs (same with Linux, not tested)
   - OpenResty / Nginx version (cmd: `nginx -V` or `openresty -V`): nginx version: openresty/1.19.3.2
   
   
   
   ### Steps to reproduce
   
   1. Configure a route with a wrong service_name not registered in Nacos.
   2. The fetch data request for service_name configured in 1) failed or timeout is reached, it will break the loop, 
   and the next requests to fetch data will be skipped but they are correctly configured.
   
   ### Actual result
   
   The next requests to fetch data will be skipped but they are correctly configured if the previous request not correctly configured or timeout reached.
   
   ### Error log
   
   log.error('get_url:', instance_list_path, ' err:', err)
   
   ### Expected result
   
   The next requests to fetch data will be not skipped  when  the previous request not correctly configured or timeout reached.


-- 
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: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix] Zheaoli commented on issue #4949: bug: The logic for method fetch_full_registry in nacos.lua will break the loop if the previous get_url request failed

Posted by GitBox <gi...@apache.org>.
Zheaoli commented on issue #4949:
URL: https://github.com/apache/apisix/issues/4949#issuecomment-910215752


   Yes, You are right. Maybe its a bad idea to return direct


-- 
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: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix] spacewander closed issue #4949: bug: The logic for method fetch_full_registry in nacos.lua will break the loop if the previous get_url request failed

Posted by GitBox <gi...@apache.org>.
spacewander closed issue #4949:
URL: https://github.com/apache/apisix/issues/4949


   


-- 
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: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org