resty http got BAD ARGUMENT exception by accident
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 20/100
- Issue 类型
- 缺陷
- 描述清晰度
- 需要澄清
- 活跃度
- 停滞
- 技术栈
- lua, nginx
- 领域
- networking
调研方向
从 resty/http.lua:365 的 traceback 开始,然后检查 resty/consul.lua:156 和 apisix/discovery/consul/init.lua:342,以追踪请求和线程的生命周期。使用报告中的 OpenResty 1.21.4.1 环境以及提供的并发请求模式重现 BAD ARGUMENT 异常;当原因已被隔离,并且失败路径已修复或得到明确记录时,即表示完成。
由索引模型根据 Issue 内容生成。
描述
ERROR Stacks:
2023/04/06 14:14:08 [error] 121939#121939: *28808 lua entry thread aborted: runtime error: /usr/local/apisix//deps/share/lua/5.1/resty/http.lua:365: bad argument #1 to 'str_sub' (string expected, got boolean)
stack traceback:
coroutine 0:
[C]: in function 'str_sub'
/usr/local/apisix//deps/share/lua/5.1/resty/http.lua:365: in function '_receive_status'
/usr/local/apisix//deps/share/lua/5.1/resty/http.lua:777: in function 'request'
/usr/local/apisix//deps/share/lua/5.1/resty/consul.lua:156: in function 'get'
/usr/local/apisix/apisix/discovery/consul/init.lua:342: in function </usr/local/apisix/apisix/discovery/consul/init.lua:273>, context: ngx.timer
Here is the code snippet:
local function call_url1(url)
-- long pull
-- Blocking request, increase timeout
-- https://www.consul.io/api/index.html#blocking-queries
local c = http.new()
-- call the url
end
local function call_url2(url)
-- long pull
-- Blocking request, increase timeout
-- https://www.consul.io/api/index.html#blocking-queries
local c = http.new()
-- call the url
end
function _M.connect(premature)
if premature then
return
end
local url1_thread, url1_err = ngx.thread.spawn(call_url1, url1)
if not url1_thread then
log.error("spawn url1 thread error")
return
end
local url2_thread, url2_err = ngx.thread.spawn(call_url2, url2)
if not url2_thread then
log.error("spawn url2 thread error")
return
end
local thread_wait_ok, wait_res = ngx.thread.wait(url1_thread, url2_thread)
ngx.thread.kill(url1_thread)
ngx.thread.kill(url2_thread)
if not thread_wait_ok then
log.error("failed to wait thread: ", err, ", wait_res: ", wait_res)
return
end
local c3 = http.new()
-- call other url and got exception here
-- short pull
end
Ensure you have provided the following details while reporting a problem:
- The exact version of the related software, including but not limited to the OpenResty version
(if any), the NGINX core version, thengx_luamodule version,
nginx version: openresty/1.21.4.1
- 主要语言
- Lua
- 星标
- 2.1k
- 派生
- 630
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
- 提供 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 没有贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
ledgetech/lua-resty-http 的其他 Issue
-
难度 1/5 1 小时以内 新手友好度 75/100
ledgetech/lua-resty-http#337 ·
-
难度 4/5 3-5 天 新手友好度 35/100
ledgetech/lua-resty-http#334 · 1 条评论 · 1 个 reaction ·
-
难度 4/5 3-5 天 新手友好度 35/100
ledgetech/lua-resty-http#330 ·
-
难度 4/5 3-5 天 新手友好度 15/100
ledgetech/lua-resty-http#325 ·
-
难度 4/5 3-5 天 新手友好度 35/100
ledgetech/lua-resty-http#324 ·
查看 ledgetech/lua-resty-http 的全部 Issue
相似的 Issue
-
Lid close does not lock the session on Apple Silicon (lid-close bind skips omarchy-system-lid-close)未关闭
难度 1/5 1-3 小时 新手友好度 90/100
omacom/omarchy-mac#701 · 1 条评论 ·
维护者通常 1 天内回复
-
import-issue
难度 2/5 1-3 小时 新手友好度 64/100
public-transport/transitous#2553 ·
维护者通常 1 天内回复
-
Bug Forever Module - Map / Minimap Needs testing/reproduction
难度 2/5 1-3 小时 新手友好度 68/100
维护者通常 1 天内回复
-
agent-butler-finding chore
难度 1/5 1 小时以内 新手友好度 88/100
codymikol/multiverse.nvim#384 ·
维护者通常 1 天内回复
-
2个显示的问题未关闭
难度 2/5 1-3 小时 新手友好度 62/100
coolsnowwolf/lede#14209 ·