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

bug: attempt to concatenate local 'qtype' (a nil value) #11830

Open
initlisk opened this issue Dec 16, 2024 · 1 comment
Open

bug: attempt to concatenate local 'qtype' (a nil value) #11830

initlisk opened this issue Dec 16, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@initlisk
Copy link

initlisk commented Dec 16, 2024

Current Behavior

Intermittent error: attempt to concatenate local 'qtype' (a nil value)

Expected Behavior

No response

Error Logs

lua entry thread aborted: runtime error: /usr/local/apisix//deps/share/lua/5.1/resty/dns/client.lua:128: attempt to concatenate local 'qtype' (a nil value)
stack traceback:
coroutine 0:
/usr/local/apisix//deps/share/lua/5.1/resty/dns/client.lua: in function 'cachelookup'
/usr/local/apisix//deps/share/lua/5.1/resty/dns/client.lua:204: in function 'cacheinsert'
/usr/local/apisix//deps/share/lua/5.1/resty/dns/client.lua:685: in function 'parseAnswer'
/usr/local/apisix//deps/share/lua/5.1/resty/dns/client.lua:736: in function </usr/local/apisix//deps/share/lua/5.1/resty/dns/client.lua:719>, context: ngx.timer

Steps to Reproduce

I'm sorry, I don't know how to reproduce this bug. The probability of this bug occurring is very low; it only appears occasionally. By looking at the source code, I couldn't find where the problem might be.

Environment

  • APISIX version (run apisix version):2.15.2
  • Operating system (run uname -a):5.10.134-13.1.al8.x86_64 SMP x86_64 Linux
  • OpenResty / Nginx version (run openresty -V or nginx -V):nginx version: openresty/1.21.4.1
    built by gcc 10.3.1 20210424 (Alpine 10.3.1_git20210424)
    built with OpenSSL 1.1.1g 21 Apr 2020
    TLS SNI support enabled
  • 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):/usr/local/bin/luarocks 3.8.0

@dosubot dosubot bot added the bug Something isn't working label Dec 16, 2024
@initlisk
Copy link
Author

initlisk commented Dec 16, 2024

I add some log to /usr/local/apisix//deps/share/lua/5.1/resty/dns/client.lua:asyncQuery
`local function asyncQuery(qname, r_opts, try_list)
local key = qname..":"..r_opts.qtype
local item = queue[key]
if item then
--[[
log(DEBUG, PREFIX, "Query async (exists): ", key, " ", fquery(item))
--]]
try_status(try_list, "in progress (async)")
return item -- already in progress, return existing query
end

local nil_qtype = false
if r_opts.qtype == nil then
nil_qtype = true
end

item = {
key = key,
semaphore = semaphore(),
qname = qname,
r_opts = deepcopy(r_opts),
try_list = try_list,
}

if item.r_opts.qtype == nil or nil_qtype then
log(ERR, PREFIX, "item nil qtype in async, ", nil_qtype, " item ropts, ",json(item.r_opts), " key=", key, "try list=", tostring(try_list))
end

queue[key] = item

local ok, err = timer_at(0, executeQuery, item)
if not ok then
queue[key] = nil
log(ERR, PREFIX, "Failed to create a timer: ", err)
return nil, "asyncQuery failed to create timer: "..err
end
--[[
log(DEBUG, PREFIX, "Query async (scheduled): ", key, " ", fquery(item))
--]]
try_status(try_list, "scheduled")

return item
end`

and the error logs is

item nil qtype in async, false item ropts, {} key=***.rds.aliyuncs.com:1try list=["(short)***.rds.aliyuncs.com:(na) - cache-hit/stale","***.rds.aliyuncs.com.test-back.svc.cluster.local:1 - cache-hit/dns server error: 3 name error","***.rds.aliyuncs.com.svc.cluster.local:1 - cache-hit/dns server error: 3 name error","***.rds.aliyuncs.com.cluster.local:1 - cache-hit/dns server error: 3 name error","***.rds.aliyuncs.com:1 - cache-hit/stale"]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: 📋 Backlog
Development

No branches or pull requests

1 participant