You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by "ShenFeng312 (via GitHub)" <gi...@apache.org> on 2024/01/16 08:03:16 UTC

[I] bug: dns_client return recursion detected [apisix]

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

   ### Current Behavior
   
   IP 172.20.12.25.33515 > 172.21.0.10.53: 3305+ CNAME? www.baidu.com.xxxxxxxxxxxxx (69)
   IP 172.21.0.10.53 > 172.20.12.25.33515: 3305 2/0/0 CNAME www.baidu.com., CNAME www.a.shifen.com. (190)
   
   request dns CNAME? www.baidu.com.xxxxxxxxxxxxx 
   response  CNAME www.baidu.com., CNAME www.a.shifen.com.
   choose first CNAME www.baidu.com.
   it has requested return recursion detected
   
   ### Expected Behavior
   
   IP 172.20.12.25.33515 > 172.21.0.10.53: 3305+ CNAME? www.baidu.com.xxxxxxxxxxxxx (69)
   IP 172.21.0.10.53 > 172.20.12.25.33515: 3305 2/0/0 CNAME www.baidu.com., CNAME www.a.shifen.com. (190)
   
   request dns CNAME? www.baidu.com.xxxxxxxxxxxxx 
   response  CNAME www.baidu.com., CNAME www.a.shifen.com.
   choose first CNAME www.baidu.com.
   it has requested. skip
   request dns  CNAME? www.a.shifen.com
   .....
   
   
   ### Error Logs
   
   _No response_
   
   ### Steps to Reproduce
   
   make dns repsoene same domian
   
   ### Environment
   
   - APISIX version (run `apisix version`):
   - Operating system (run `uname -a`):
   - OpenResty / Nginx version (run `openresty -V` or `nginx -V`):
   - etcd version, if relevant (run `curl http://127.0.0.1:9090/v1/server_info`):
   - APISIX Dashboard version, if relevant:
   - Plugin runner version, for issues related to plugin runners:
   - LuaRocks version, for installation issues (run `luarocks --version`):
   


-- 
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.apache.org

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


Re: [I] bug: dns_client return recursion detected [apisix]

Posted by "ShenFeng312 (via GitHub)" <gi...@apache.org>.
ShenFeng312 commented on issue #10829:
URL: https://github.com/apache/apisix/issues/10829#issuecomment-1893320210

   > > ```lua
   > >       if records then
   > >         -- we have a result
   > > 
   > >         -- cache it under its shortname
   > >         if not dnsCacheOnly then
   > >           cacheShortInsert(records, qname, qtype)
   > >         end
   > > 
   > >         -- check if we need to dereference a CNAME
   > >         if records[1].type == _M.TYPE_CNAME and qtype ~= _M.TYPE_CNAME then
   > >           -- dereference CNAME
   > >           opts.qtype = nil
   > >           try_status(try_list, "dereferencing")
   > >           return resolve(records[1].cname, opts, dnsCacheOnly, try_list)
   > >         end
   > > 
   > >         return records, nil, try_list
   > >       end
   > > ```
   > 
   > did u mean we need to update this repo to resoulv the issue https://github.com/api7/lua-resty-dns-client
   
   yes @Vacant2333 


-- 
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


Re: [I] bug: dns_client return recursion detected [apisix]

Posted by "ShenFeng312 (via GitHub)" <gi...@apache.org>.
ShenFeng312 commented on issue #10829:
URL: https://github.com/apache/apisix/issues/10829#issuecomment-1911530770

   some other issues The other issues arising from this https://github.com/apache/apisix/issues/4874


-- 
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


Re: [I] bug: dns_client return recursion detected [apisix]

Posted by "ShenFeng312 (via GitHub)" <gi...@apache.org>.
ShenFeng312 commented on issue #10829:
URL: https://github.com/apache/apisix/issues/10829#issuecomment-1910023548

   I have added some logs that I hope you can understand. I believe the entire DNS resolution process may be incorrect. We may need to refactor this portion of the code. Below, I will describe the issues I have encountered and provide evidence. You can see the logs I added at [cliet.lua](https://github.com/ShenFeng312/lua-resty-dns-client/blob/master/src/resty/dns/client.lua).
    1. my log 
   ```
   2024/01/25 18:08:35 [warn] 32#32: *13313 [lua] client.lua:1132: resolve(): [dns-client] resolve qname:www.baidu.comopts:nulltry_listnull, client: 127.0.0.1, server: _, request: "GET /proout HTTP/1.1", host: "localhost:9080"
   2024/01/25 18:08:35 [warn] 32#32: *13313 [lua] client.lua:1154: resolve(): [dns-client] from cache try_name:www.baidu.comqtype:nil records:null, client: 127.0.0.1, server: _, request: "GET /proout HTTP/1.1", host: "localhost:9080"
   2024/01/25 18:08:35 [warn] 32#32: *13314 [lua] client.lua:642: parseAnswer(): [dns-client] parseAnswer qname:www.baidu.com.jck-namespace-50714.svc.cluster.localqtype1, context: ngx.timer, client: 127.0.0.1, server: 0.0.0.0:9080
   2024/01/25 18:08:35 [warn] 32#32: *13314 [lua] client.lua:672: parseAnswer(): [dns-client] remove{"class":1,"section":1,"ttl":10,"address":"220.181.38.150","type":1,"name":"www.a.shifen.com"}, context: ngx.timer, client: 127.0.0.1, server: 0.0.0.0:9080
   2024/01/25 18:08:35 [warn] 32#32: *13314 [lua] client.lua:672: parseAnswer(): [dns-client] remove{"class":1,"section":1,"ttl":10,"address":"220.181.38.149","type":1,"name":"www.a.shifen.com"}, context: ngx.timer, client: 127.0.0.1, server: 0.0.0.0:9080
   2024/01/25 18:08:35 [warn] 32#32: *13314 [lua] client.lua:672: parseAnswer(): [dns-client] remove{"class":1,"section":1,"cname":"www.a.shifen.com","ttl":10,"type":5,"name":"www.baidu.com"}, context: ngx.timer, client: 127.0.0.1, server: 0.0.0.0:9080
   2024/01/25 18:08:35 [warn] 32#32: *13314 [lua] client.lua:672: parseAnswer(): [dns-client] remove{"class":1,"section":1,"cname":"www.baidu.com","ttl":10,"type":5,"name":"www.baidu.com.jck-namespace-50714.svc.cluster.local"}, context: ngx.timer, client: 127.0.0.1, server: 0.0.0.0:9080
   2024/01/25 18:08:35 [warn] 32#32: *13313 [lua] client.lua:1230: resolve(): [dns-client] try_name:www.baidu.com.jck-namespace-50714.svc.cluster.localopts:{"additional_section":true,"qtype":1}records:{"ttl":30,"expired":false,"touch":1706177315.583,"expire":1706177345.583}, client: 127.0.0.1, server: _, request: "GET /proout HTTP/1.1", host: "localhost:9080"
   2024/01/25 18:08:35 [warn] 32#32: *13316 [lua] client.lua:642: parseAnswer(): [dns-client] parseAnswer qname:www.baidu.com.svc.cluster.localqtype1, context: ngx.timer, client: 127.0.0.1, server: 0.0.0.0:9080
   2024/01/25 18:08:35 [warn] 32#32: *13313 [lua] client.lua:1230: resolve(): [dns-client] try_name:www.baidu.com.svc.cluster.localopts:{"additional_section":true,"qtype":1}records:{"errstr":"name error","touch":1706177315.584,"errcode":3,"ttl":30,"expired":false,"expire":1706177345.584}, client: 127.0.0.1, server: _, request: "GET /proout HTTP/1.1", host: "localhost:9080"
   2024/01/25 18:08:35 [warn] 32#32: *13318 [lua] client.lua:642: parseAnswer(): [dns-client] parseAnswer qname:www.baidu.com.cluster.localqtype1, context: ngx.timer, client: 127.0.0.1, server: 0.0.0.0:9080
   2024/01/25 18:08:35 [warn] 32#32: *13313 [lua] client.lua:1230: resolve(): [dns-client] try_name:www.baidu.com.cluster.localopts:{"additional_section":true,"qtype":1}records:{"errstr":"name error","touch":1706177315.584,"errcode":3,"ttl":30,"expired":false,"expire":1706177345.584}, client: 127.0.0.1, server: _, request: "GET /proout HTTP/1.1", host: "localhost:9080"
   2024/01/25 18:08:35 [warn] 32#32: *13320 [lua] client.lua:642: parseAnswer(): [dns-client] parseAnswer qname:www.baidu.comqtype1, context: ngx.timer, client: 127.0.0.1, server: 0.0.0.0:9080
   2024/01/25 18:08:35 [warn] 32#32: *13320 [lua] client.lua:672: parseAnswer(): [dns-client] remove{"class":1,"section":1,"ttl":10,"address":"220.181.38.150","type":1,"name":"www.a.shifen.com"}, context: ngx.timer, client: 127.0.0.1, server: 0.0.0.0:9080
   2024/01/25 18:08:35 [warn] 32#32: *13320 [lua] client.lua:672: parseAnswer(): [dns-client] remove{"class":1,"section":1,"ttl":10,"address":"220.181.38.149","type":1,"name":"www.a.shifen.com"}, context: ngx.timer, client: 127.0.0.1, server: 0.0.0.0:9080
   2024/01/25 18:08:35 [warn] 32#32: *13320 [lua] client.lua:672: parseAnswer(): [dns-client] remove{"class":1,"section":1,"cname":"www.a.shifen.com","ttl":10,"type":5,"name":"www.baidu.com"}, context: ngx.timer, client: 127.0.0.1, server: 0.0.0.0:9080
   2024/01/25 18:08:35 [warn] 32#32: *13313 [lua] client.lua:1230: resolve(): [dns-client] try_name:www.baidu.comopts:{"additional_section":true,"qtype":1}records:{"ttl":30,"expired":false,"touch":1706177315.585,"expire":1706177345.585}, client: 127.0.0.1, server: _, request: "GET /proout HTTP/1.1", host: "localhost:9080"
   2024/01/25 18:08:35 [warn] 32#32: *13322 [lua] client.lua:642: parseAnswer(): [dns-client] parseAnswer qname:www.baidu.com.jck-namespace-50714.svc.cluster.localqtype28, context: ngx.timer, client: 127.0.0.1, server: 0.0.0.0:9080
   2024/01/25 18:08:35 [warn] 32#32: *13322 [lua] client.lua:672: parseAnswer(): [dns-client] remove{"class":1,"section":1,"ttl":5,"address":"240e:83:205:58:0:ff:b09f:36bf","type":28,"name":"www.a.shifen.com"}, context: ngx.timer, client: 127.0.0.1, server: 0.0.0.0:9080
   2024/01/25 18:08:35 [warn] 32#32: *13322 [lua] client.lua:672: parseAnswer(): [dns-client] remove{"class":1,"section":1,"ttl":5,"address":"240e:83:205:5a:0:ff:b05f:346b","type":28,"name":"www.a.shifen.com"}, context: ngx.timer, client: 127.0.0.1, server: 0.0.0.0:9080
   2024/01/25 18:08:35 [warn] 32#32: *13322 [lua] client.lua:672: parseAnswer(): [dns-client] remove{"class":1,"section":1,"cname":"www.a.shifen.com","ttl":5,"type":5,"name":"www.baidu.com"}, context: ngx.timer, client: 127.0.0.1, server: 0.0.0.0:9080
   2024/01/25 18:08:35 [warn] 32#32: *13322 [lua] client.lua:672: parseAnswer(): [dns-client] remove{"class":1,"section":1,"cname":"www.baidu.com","ttl":5,"type":5,"name":"www.baidu.com.jck-namespace-50714.svc.cluster.local"}, context: ngx.timer, client: 127.0.0.1, server: 0.0.0.0:9080
   2024/01/25 18:08:35 [warn] 32#32: *13313 [lua] client.lua:1230: resolve(): [dns-client] try_name:www.baidu.com.jck-namespace-50714.svc.cluster.localopts:{"additional_section":true,"qtype":28}records:{"ttl":30,"expired":false,"touch":1706177315.587,"expire":1706177345.587}, client: 127.0.0.1, server: _, request: "GET /proout HTTP/1.1", host: "localhost:9080"
   2024/01/25 18:08:35 [warn] 32#32: *13324 [lua] client.lua:642: parseAnswer(): [dns-client] parseAnswer qname:www.baidu.com.svc.cluster.localqtype28, context: ngx.timer, client: 127.0.0.1, server: 0.0.0.0:9080
   2024/01/25 18:08:35 [warn] 32#32: *13313 [lua] client.lua:1230: resolve(): [dns-client] try_name:www.baidu.com.svc.cluster.localopts:{"additional_section":true,"qtype":28}records:{"errstr":"name error","touch":1706177315.588,"errcode":3,"ttl":30,"expired":false,"expire":1706177345.588}, client: 127.0.0.1, server: _, request: "GET /proout HTTP/1.1", host: "localhost:9080"
   2024/01/25 18:08:35 [warn] 32#32: *13326 [lua] client.lua:642: parseAnswer(): [dns-client] parseAnswer qname:www.baidu.com.cluster.localqtype28, context: ngx.timer, client: 127.0.0.1, server: 0.0.0.0:9080
   2024/01/25 18:08:35 [warn] 32#32: *13313 [lua] client.lua:1230: resolve(): [dns-client] try_name:www.baidu.com.cluster.localopts:{"additional_section":true,"qtype":28}records:{"errstr":"name error","touch":1706177315.59,"errcode":3,"ttl":30,"expired":false,"expire":1706177345.59}, client: 127.0.0.1, server: _, request: "GET /proout HTTP/1.1", host: "localhost:9080"
   2024/01/25 18:08:35 [warn] 32#32: *13328 [lua] client.lua:642: parseAnswer(): [dns-client] parseAnswer qname:www.baidu.comqtype28, context: ngx.timer, client: 127.0.0.1, server: 0.0.0.0:9080
   2024/01/25 18:08:35 [warn] 32#32: *13328 [lua] client.lua:672: parseAnswer(): [dns-client] remove{"class":1,"section":1,"ttl":5,"address":"240e:83:205:5a:0:ff:b05f:346b","type":28,"name":"www.a.shifen.com"}, context: ngx.timer, client: 127.0.0.1, server: 0.0.0.0:9080
   2024/01/25 18:08:35 [warn] 32#32: *13328 [lua] client.lua:672: parseAnswer(): [dns-client] remove{"class":1,"section":1,"ttl":5,"address":"240e:83:205:58:0:ff:b09f:36bf","type":28,"name":"www.a.shifen.com"}, context: ngx.timer, client: 127.0.0.1, server: 0.0.0.0:9080
   2024/01/25 18:08:35 [warn] 32#32: *13328 [lua] client.lua:672: parseAnswer(): [dns-client] remove{"class":1,"section":1,"cname":"www.a.shifen.com","ttl":5,"type":5,"name":"www.baidu.com"}, context: ngx.timer, client: 127.0.0.1, server: 0.0.0.0:9080
   2024/01/25 18:08:35 [warn] 32#32: *13313 [lua] client.lua:1230: resolve(): [dns-client] try_name:www.baidu.comopts:{"additional_section":true,"qtype":28}records:{"ttl":30,"expired":false,"touch":1706177315.591,"expire":1706177345.591}, client: 127.0.0.1, server: _, request: "GET /proout HTTP/1.1", host: "localhost:9080"
   2024/01/25 18:08:35 [warn] 32#32: *13313 [lua] client.lua:921: lookup(): [dns-client] from cach, client: 127.0.0.1, server: _, request: "GET /proout HTTP/1.1", host: "localhost:9080"
   2024/01/25 18:08:35 [warn] 32#32: *13313 [lua] client.lua:1230: resolve(): [dns-client] try_name:www.baidu.com.jck-namespace-50714.svc.cluster.localopts:{"additional_section":true,"qtype":5}records:{"1":{"class":1,"section":1,"cname":"www.baidu.com","ttl":5,"type":5,"name":"www.baidu.com.jck-namespace-50714.svc.cluster.local"},"ttl":5,"expired":false,"touch":1706177315.591,"expire":1706177320.587}, client: 127.0.0.1, server: _, request: "GET /proout HTTP/1.1", host: "localhost:9080"
   2024/01/25 18:08:35 [warn] 32#32: *13313 [lua] client.lua:1132: resolve(): [dns-client] resolve qname:www.baidu.comopts:{"additional_section":true}try_list{"1":{"qname":"(short)www.baidu.com","msg":["cache-miss"]},"2":{"qname":"www.baidu.com.jck-namespace-50714.svc.cluster.local","msg":["cache-miss","scheduled","querying","1:www.a.shifen.com removed","1:www.a.shifen.com removed","5:www.baidu.com removed","5:www.baidu.com.jck-namespace-50714.svc.cluster.local removed","dns client error: 101 empty record received"],"qtype":1},"3":{"qname":"www.baidu.com.svc.cluster.local","msg":["cache-miss","scheduled","querying","dns server error: 3 name error"],"qtype":1},"4":{"qname":"www.baidu.com.cluster.local","msg":["cache-miss","scheduled","querying","dns server error: 3 name error"],"qtype":1},"5":{"qname":"www.baidu.com","msg":["cache-miss","scheduled","querying","1:www.a.shifen.com removed","1:www.a.shifen.com removed","5:www.baidu.com removed","dns client error: 101 empty record receive
 d"],"qtype":1},"6":{"qname":"www.baidu.com.jck-namespace-50714.svc.cluster.local","msg":["cache-miss","scheduled","querying","28:www.a.shifen.com removed","28:www.a.shifen.com removed","5:www.baidu.com removed","5:www.baidu.com.jck-namespace-50714.svc.cluster.local removed","dns client error: 101 empty record received"],"qtype":28},"7":{"qname":"www.baidu.com.svc.cluster.local","msg":["cache-miss","scheduled","querying","dns server error: 3 name error"],"qtype":28},"8":{"qname":"www.baidu.com.cluster.local","msg":["cache-miss","scheduled","querying","dns server error: 3 name error"],"qtype":28},"9":{"qname":"www.baidu.com","msg":["cache-miss","scheduled","querying","28:www.a.shifen.com removed","28:www.a.shifen.com removed","5:www.baidu.com removed","dns client error: 101 empty record received"],"qtype":28},"10":{"qname":"www.baidu.com.jck-namespace-50714.svc.cluster.local","msg":["cache-hit","dereferencing"],"qtype":5},"www.baidu.com.jck-namespace-50714.svc.cluster.local:5":10,"www
 .baidu.com.cluster.local:28":8,"www.baidu.com.svc.cluster.local:1":3,"(short)www.baidu.com:nil":1,"www.baidu.com:28":9,"www.baidu.com:1":5,"www.baidu.com.cluster.local:1":4,"www.baidu.com.jck-namespace-50714.svc.cluster.local:1":2,"www.baidu.com.jck-namespace-50714.svc.cluster.local:28":6,"www.baidu.com.svc.cluster.local:28":7}, client: 127.0.0.1, server: _, request: "GET /proout HTTP/1.1", host: "localhost:9080"
   2024/01/25 18:08:35 [warn] 32#32: *13313 [lua] client.lua:1154: resolve(): [dns-client] from cache try_name:www.baidu.comqtype:nil records:{"1":{"class":1,"section":1,"cname":"www.baidu.com","ttl":5,"type":5,"name":"www.baidu.com.jck-namespace-50714.svc.cluster.local"},"ttl":5,"expired":false,"touch":1706177315.591,"expire":1706177320.587}, client: 127.0.0.1, server: _, request: "GET /proout HTTP/1.1", host: "localhost:9080"
   2024/01/25 18:08:35 [error] 32#32: *13313 [lua] client.lua:1164: resolve(): [dns-client] resolve qname:www.baidu.comopts:{"additional_section":true}try_list{"1":{"qname":"(short)www.baidu.com","msg":["cache-miss"]},"2":{"qname":"www.baidu.com.jck-namespace-50714.svc.cluster.local","msg":["cache-miss","scheduled","querying","1:www.a.shifen.com removed","1:www.a.shifen.com removed","5:www.baidu.com removed","5:www.baidu.com.jck-namespace-50714.svc.cluster.local removed","dns client error: 101 empty record received"],"qtype":1},"3":{"qname":"www.baidu.com.svc.cluster.local","msg":["cache-miss","scheduled","querying","dns server error: 3 name error"],"qtype":1},"4":{"qname":"www.baidu.com.cluster.local","msg":["cache-miss","scheduled","querying","dns server error: 3 name error"],"qtype":1},"5":{"qname":"www.baidu.com","msg":["cache-miss","scheduled","querying","1:www.a.shifen.com removed","1:www.a.shifen.com removed","5:www.baidu.com removed","dns client error: 101 empty record receiv
 ed"],"qtype":1},"6":{"qname":"www.baidu.com.jck-namespace-50714.svc.cluster.local","msg":["cache-miss","scheduled","querying","28:www.a.shifen.com removed","28:www.a.shifen.com removed","5:www.baidu.com removed","5:www.baidu.com.jck-namespace-50714.svc.cluster.local removed","dns client error: 101 empty record received"],"qtype":28},"7":{"qname":"www.baidu.com.svc.cluster.local","msg":["cache-miss","scheduled","querying","dns server error: 3 name error"],"qtype":28},"8":{"qname":"www.baidu.com.cluster.local","msg":["cache-miss","scheduled","querying","dns server error: 3 name error"],"qtype":28},"9":{"qname":"www.baidu.com","msg":["cache-miss","scheduled","querying","28:www.a.shifen.com removed","28:www.a.shifen.com removed","5:www.baidu.com removed","dns client error: 101 empty record received"],"qtype":28},"10":{"qname":"www.baidu.com.jck-namespace-50714.svc.cluster.local","msg":["cache-hit","dereferencing"],"qtype":5},"www.baidu.com.jck-namespace-50714.svc.cluster.local:5":10,"ww
 w.baidu.com.cluster.local:28":8,"www.baidu.com.svc.cluster.local:1":3,"(short)www.baidu.com:nil":1,"www.baidu.com:28":9,"www.baidu.com:1":5,"www.baidu.com.cluster.local:1":4,"www.baidu.com.jck-namespace-50714.svc.cluster.local:1":2,"www.baidu.com.jck-namespace-50714.svc.cluster.local:28":6,"www.baidu.com.svc.cluster.local:28":7}error, client: 127.0.0.1, server: _, request: "GET /proout HTTP/1.1", host: "localhost:9080"
   ```
   2. tcpdump info
   ```
   istening on eth0, link-type EN10MB (Ethernet), snapshot length 262144 bytes
   IP 172.16.5.241.33243 > 172.17.0.10.53: 11191+ A? www.baidu.com.jck-namespace-50714.svc.cluster.local. (69)
   IP 172.17.0.10.53 > 172.16.5.241.33243: 11191 4/0/0 CNAME www.baidu.com., CNAME www.a.shifen.com., A 220.181.38.149, A 220.181.38.150 (254)
   IP 172.16.5.241.42954 > 172.17.0.10.53: 63630+ A? www.baidu.com.svc.cluster.local. (49)
   IP 172.17.0.10.53 > 172.16.5.241.42954: 63630 NXDomain*- 0/1/0 (142)
   IP 172.16.5.241.57577 > 172.17.0.10.53: 820+ A? www.baidu.com.cluster.local. (45)
   IP 172.17.0.10.53 > 172.16.5.241.57577: 820 NXDomain*- 0/1/0 (138)
   IP 172.16.5.241.47253 > 172.17.0.10.53: 51953+ A? www.baidu.com. (31)
   IP 172.17.0.10.53 > 172.16.5.241.47253: 51953 3/0/0 CNAME www.a.shifen.com., A 220.181.38.149, A 220.181.38.150 (138)
   IP 172.16.5.241.35343 > 172.17.0.10.53: 16080+ AAAA? www.baidu.com.jck-namespace-50714.svc.cluster.local. (69)
   IP 172.17.0.10.53 > 172.16.5.241.35343: 16080 4/0/0 CNAME www.baidu.com., CNAME www.a.shifen.com., AAAA 240e:83:205:5a:0:ff:b05f:346b, AAAA 240e:83:205:58:0:ff:b09f:36bf (278)
   IP 172.16.5.241.54315 > 172.17.0.10.53: 27947+ AAAA? www.baidu.com.svc.cluster.local. (49)
   IP 172.17.0.10.53 > 172.16.5.241.54315: 27947 NXDomain*- 0/1/0 (142)
   IP 172.16.5.241.35874 > 172.17.0.10.53: 22459+ AAAA? www.baidu.com.cluster.local. (45)
   IP 172.17.0.10.53 > 172.16.5.241.35874: 22459 NXDomain*- 0/1/0 (138)
   IP 172.16.5.241.41147 > 172.17.0.10.53: 54795+ AAAA? www.baidu.com. (31)
   IP 172.17.0.10.53 > 172.16.5.241.41147: 54795 3/0/0 CNAME www.a.shifen.com., AAAA 240e:83:205:58:0:ff:b09f:36bf, AAAA 240e:83:205:5a:0:ff:b05f:346b (162)
   
   ```
   3. use `nslookup www.baidu.com` and get tcp info
   ```
   tcpdump -i eth0 -nnt udp
   tcpdump: verbose output suppressed, use -v[v]... for full protocol decode
   listening on eth0, link-type EN10MB (Ethernet), snapshot length 262144 bytes
   IP 172.16.5.241.41251 > 172.17.0.10.53: 6935+ A? www.baidu.com.jck-namespace-50714.svc.cluster.local. (69)
   IP 172.17.0.10.53 > 172.16.5.241.41251: 6935 4/0/0 CNAME www.baidu.com., CNAME www.a.shifen.com., A 220.181.38.150, A 220.181.38.149 (254)
   IP 172.16.5.241.42715 > 172.17.0.10.53: 28935+ AAAA? www.a.shifen.com. (34)
   IP 172.17.0.10.53 > 172.16.5.241.42715: 28935 2/0/0 AAAA 240e:83:205:58:0:ff:b09f:36bf, AAAA 240e:83:205:5a:0:ff:b05f:346b (122)
   ```
   We can see from the logs and packet capture information that, in fact, we have received valid data from the DNS at `A? www.baidu.com.jck-namespace-50714.svc.cluster.local. (69)` But, in the parseAnswer function, we removed it.
   ```
   2024/01/25 18:08:35 [warn] 32#32: *13314 [lua] client.lua:672: parseAnswer(): [dns-client] remove{"class":1,"section":1,"ttl":10,"address":"220.181.38.150","type":1,"name":"www.a.shifen.com"}, context: ngx.timer, client: 127.0.0.1, server: 0.0.0.0:9080
   2024/01/25 18:08:35 [warn] 32#32: *13314 [lua] client.lua:672: parseAnswer(): [dns-client] remove{"class":1,"section":1,"ttl":10,"address":"220.181.38.149","type":1,"name":"www.a.shifen.com"}, context: ngx.timer, client: 127.0.0.1, server: 0.0.0.0:9080
   ```
   And based on the behavior of nslookup, I believe we need to iterate through all records until it can return an IP address, instead of just selecting one.
   ```lua
   
               if records then
                   -- we have a result
   
                   -- cache it under its shortname
                   if not dnsCacheOnly then
                       cacheShortInsert(records, qname, qtype)
                   end
   
                   -- check if we need to dereference a CNAME
                   if records[1].type == _M.TYPE_CNAME and qtype ~= _M.TYPE_CNAME then
                       -- dereference CNAME
                       opts.qtype = nil
                       try_status(try_list, "dereferencing")
                       return resolve(records[1].cname, opts, dnsCacheOnly, try_list)
                   end
   
                   return records, nil, try_list
               end
   ```
   
   
   @Vacant2333 @shreemaan-abhishek @lakshya8066 
   
   


-- 
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


Re: [I] bug: dns_client return recursion detected [apisix]

Posted by "shreemaan-abhishek (via GitHub)" <gi...@apache.org>.
shreemaan-abhishek commented on issue #10829:
URL: https://github.com/apache/apisix/issues/10829#issuecomment-1920591726

   @ShenFeng312 I still do not understand. And I cannot read chinese so I don't understand #4847 either.
   
   Can you provide detailed reproduction steps?


-- 
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


Re: [I] bug: dns_client return recursion detected [apisix]

Posted by "ShenFeng312 (via GitHub)" <gi...@apache.org>.
ShenFeng312 commented on issue #10829:
URL: https://github.com/apache/apisix/issues/10829#issuecomment-1914233450

   @shreemaan-abhishek @lakshya8066 @Vacant2333 
   Do you need me to add any other information?


-- 
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


Re: [I] bug: dns_client return recursion detected [apisix]

Posted by "Vacant2333 (via GitHub)" <gi...@apache.org>.
Vacant2333 commented on issue #10829:
URL: https://github.com/apache/apisix/issues/10829#issuecomment-1909216544

   @ShenFeng312 can u help provide more informations? its not clear and hard to understand now, thanks!


-- 
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


Re: [I] bug: dns_client return recursion detected [apisix]

Posted by "ShenFeng312 (via GitHub)" <gi...@apache.org>.
ShenFeng312 commented on issue #10829:
URL: https://github.com/apache/apisix/issues/10829#issuecomment-1893240527

   ```lua
         if records then
           -- we have a result
   
           -- cache it under its shortname
           if not dnsCacheOnly then
             cacheShortInsert(records, qname, qtype)
           end
   
           -- check if we need to dereference a CNAME
           if records[1].type == _M.TYPE_CNAME and qtype ~= _M.TYPE_CNAME then
             -- dereference CNAME
             opts.qtype = nil
             try_status(try_list, "dereferencing")
             return resolve(records[1].cname, opts, dnsCacheOnly, try_list)
           end
   
           return records, nil, try_list
         end
   ```
   


-- 
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


Re: [I] bug: dns_client return recursion detected [apisix]

Posted by "Vacant2333 (via GitHub)" <gi...@apache.org>.
Vacant2333 commented on issue #10829:
URL: https://github.com/apache/apisix/issues/10829#issuecomment-1904024349

   > > @ShenFeng312 do you want to raise a PR to fix this?
   > 
   > I think I need some help. I don't know how to mock DNS resolution in unit tests. @lakshya8066
   
   @shreemaan-abhishek hi!, can u help him?


-- 
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


Re: [I] bug: dns_client return recursion detected [apisix]

Posted by "ShenFeng312 (via GitHub)" <gi...@apache.org>.
ShenFeng312 closed issue #10829: bug: dns_client return recursion detected
URL: https://github.com/apache/apisix/issues/10829


-- 
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


Re: [I] bug: dns_client return recursion detected [apisix]

Posted by "ShenFeng312 (via GitHub)" <gi...@apache.org>.
ShenFeng312 commented on issue #10829:
URL: https://github.com/apache/apisix/issues/10829#issuecomment-1920640240

   > @ShenFeng312 I still do not understand. And I cannot read chinese so I don't understand #4847 either.
   > 
   > Can you provide detailed reproduction steps?
   I will create two new issues and intend to close this one, as there may be two different bugs @shreemaan-abhishek 
   


-- 
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


Re: [I] bug: dns_client return recursion detected [apisix]

Posted by "shreemaan-abhishek (via GitHub)" <gi...@apache.org>.
shreemaan-abhishek commented on issue #10829:
URL: https://github.com/apache/apisix/issues/10829#issuecomment-1908127498

   @ShenFeng312
   1. I do not understand your issue, could you please elaborate it better?
   2. To mock DNS resolution in unit tests. You may add entries in resolv.conf (would this work? 🤔 )


-- 
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


Re: [I] bug: dns_client return recursion detected [apisix]

Posted by "ShenFeng312 (via GitHub)" <gi...@apache.org>.
ShenFeng312 commented on issue #10829:
URL: https://github.com/apache/apisix/issues/10829#issuecomment-1893315411

   > > ```lua
   > 
   > >       if records then
   > 
   > >         -- we have a result
   > 
   > > 
   > 
   > >         -- cache it under its shortname
   > 
   > >         if not dnsCacheOnly then
   > 
   > >           cacheShortInsert(records, qname, qtype)
   > 
   > >         end
   > 
   > > 
   > 
   > >         -- check if we need to dereference a CNAME
   > 
   > >         if records[1].type == _M.TYPE_CNAME and qtype ~= _M.TYPE_CNAME then
   > 
   > >           -- dereference CNAME
   > 
   > >           opts.qtype = nil
   > 
   > >           try_status(try_list, "dereferencing")
   > 
   > >           return resolve(records[1].cname, opts, dnsCacheOnly, try_list)
   > 
   > >         end
   > 
   > > 
   > 
   > >         return records, nil, try_list
   > 
   > >       end
   > 
   > > ```
   > 
   > 
   > 
   > did u mean we need to update this repo to resoulv the issue https://github.com/api7/lua-resty-dns-client
   
   yes


-- 
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


Re: [I] bug: dns_client return recursion detected [apisix]

Posted by "lakshya8066 (via GitHub)" <gi...@apache.org>.
lakshya8066 commented on issue #10829:
URL: https://github.com/apache/apisix/issues/10829#issuecomment-1896255567

   @ShenFeng312 do you want to raise a PR to fix this?


-- 
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


Re: [I] bug: dns_client return recursion detected [apisix]

Posted by "Vacant2333 (via GitHub)" <gi...@apache.org>.
Vacant2333 commented on issue #10829:
URL: https://github.com/apache/apisix/issues/10829#issuecomment-1893277557

   > ```lua
   >       if records then
   >         -- we have a result
   > 
   >         -- cache it under its shortname
   >         if not dnsCacheOnly then
   >           cacheShortInsert(records, qname, qtype)
   >         end
   > 
   >         -- check if we need to dereference a CNAME
   >         if records[1].type == _M.TYPE_CNAME and qtype ~= _M.TYPE_CNAME then
   >           -- dereference CNAME
   >           opts.qtype = nil
   >           try_status(try_list, "dereferencing")
   >           return resolve(records[1].cname, opts, dnsCacheOnly, try_list)
   >         end
   > 
   >         return records, nil, try_list
   >       end
   > ```
   
   did u mean we need to update this repo to resoulv the issue https://github.com/api7/lua-resty-dns-client


-- 
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


Re: [I] bug: dns_client return recursion detected [apisix]

Posted by "ShenFeng312 (via GitHub)" <gi...@apache.org>.
ShenFeng312 commented on issue #10829:
URL: https://github.com/apache/apisix/issues/10829#issuecomment-1899979940

   > @ShenFeng312 do you want to raise a PR to fix this?
   
   I think I need some help. I don't know how to mock DNS resolution in unit tests. @lakshya8066 


-- 
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