Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

request help: APISIX retuen error 3 name error with multi Consul DNS #8345

Closed
tzssangglass opened this issue Nov 17, 2022 Discussed in #8338 · 14 comments
Closed

request help: APISIX retuen error 3 name error with multi Consul DNS #8345

tzssangglass opened this issue Nov 17, 2022 Discussed in #8338 · 14 comments

Comments

@tzssangglass
Copy link
Member

Discussed in #8338

Originally posted by Fabriceli November 16, 2022
Version info:

  • APISIX 3.0.0
  • Consul 1.9.5
  • Linux arch x86_64

ERROR:

[error] 43382#43382: *1626 [lua] init.lua:428: handle_upstream(): failed to set upstream: no valid upstream node: failed to query the DNS server: dns server error: 3 name error, client: a.a.a.a, server: _, request: "GET /api/v0/test/ HTTP/1.1", host: "b.b.b.b"

with /usr/local/apisix/conf/config.yaml:

discovery:
  dns:
    servers:
      - "x.x.x.x:8600" 
      - "y.y.y.y:8600"

service A is only valid in Consul y.y.y.y:8600. APISIX is not support multi Consul DNS?

@tzssangglass
Copy link
Member Author

tzssangglass commented Nov 17, 2022

hi @Fabriceli , I eventually tracked it down here: https://github.com/openresty/lua-resty-dns/blob/master/lib/resty/dns/resolver.lua#L870-L896

            for _ = 1, 128 do
                buf, err = sock:receive(4096)
                if err then
                    local server = _get_cur_server(self)
                    err = "failed to receive reply from UDP server "
                        .. concat(server, ":") .. ": " .. err
                    break
                end


                if buf then
                    local answers
                    answers, err = parse_response(buf, id, opts)
                    if err == "truncated" then
                        answers, err = _tcp_query(self, query, id, opts)
                    end


                    if err and err ~= "id mismatch" then
                        break
                    end


                    if answers then
                        return answers, nil, tries
                    end
                end
                -- only here in case of an "id mismatch"
            end
        end
  1. first query "service-name-x.service.dc-name-x.consul" from x.x.x.x:8600
  2. then get the buf, and err is nil, so it won't go into if err then, just parse_response(buf, id, opts) and the answers is
{
  errcode = 3,
  errstr = "name error"
}
  1. and then return this error directly, won't try to query on y.y.y.y:8600 again.

or multi DNS, APISIX is not work like this ??:

image

in your scenario, yes

@Fabriceli
Copy link
Contributor

How to fix it ?

@tzssangglass
Copy link
Member Author

How to fix it ?

I don't think it needs to be fixed. I think this is a new feature. I don't have any good ideas to implement it at the moment.

@Fabriceli
Copy link
Contributor

When can add this new feature? or make a discussion about this feature at next Community Weekly Meeting

@tokers
Copy link
Contributor

tokers commented Nov 17, 2022

@tzssangglass I think a good way to support this is to let users define multiple DNS service registries, and for each registry, one can define a group of DNS servers, which are the same for the domain resolving. While for different DNS service registries, the resolve result might be different.

@tzssangglass
Copy link
Member Author

I think a good way to support this is to let users define multiple DNS service registries, and for each registry, one can define a group of DNS servers, which are the same for the domain resolving. While for different DNS service registries, the resolve result might be different.

I think on a high level, this requires APISIX discovery mode to support multiple clusters and orchestrate query rules.

@tzssangglass
Copy link
Member Author

When can add this new feature? or make a discussion about this feature at next Community Weekly Meeting

Yes, if there is a community meeting in the near future, we will let you know in the discussion and on the mailing list.

@tokers
Copy link
Contributor

tokers commented Nov 18, 2022

I think a good way to support this is to let users define multiple DNS service registries, and for each registry, one can define a group of DNS servers, which are the same for the domain resolving. While for different DNS service registries, the resolve result might be different.

I think on a high level, this requires APISIX discovery mode to support multiple clusters and orchestrate query rules.

Right.

@Fabriceli
Copy link
Contributor

@tokers
for this feature, I create a Consul register not Consul with kv, May I create a PR to merger in master? for help other guys

@tokers
Copy link
Contributor

tokers commented Nov 21, 2022

@tokers for this feature, I create a Consul register not Consul with kv, May I create a PR to merger in master? for help other guys

That's cool. Welcome to submit PR!

@Fabriceli
Copy link
Contributor

@tokers please assign it to me

@tokers
Copy link
Contributor

tokers commented Nov 22, 2022

@tokers please assign it to me

We can create another issue to track the new consul service discovery.

@Fabriceli
Copy link
Contributor

Fabriceli commented Nov 22, 2022

@tokers please assign it to me

We can create another issue to track the new consul service discovery.

I created #8371, Could you assign this feature to me?

@shreemaan-abhishek
Copy link
Contributor

closing this as completed by #8380

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants