lua tcp socket queued connect timed out
2019-10-16 10:3:13
收藏:0
阅读:2513
评论:9
各位的大佬,lua resty request 会发生 lua tcp socket queued connect timed out错误,什么原因
GUAC.list_active_connections_request = function(host, data_source, token)
ngx.log(ngx.DEBUG, 'guac_host :', guac_host, "token : ", token)
api_uri = string.format(API_ACTIVE_CONNECTION, data_source);
url = string.format("http://%s/%s?token=%s", host, api_uri, token)
ngx.log(ngx.DEBUG, 'list_active_connections_request :', url, "token : ", token)
local req_opts = {
timeouts = GUAC.REQ_TIMEOUTS
}
local response, err = requests.request("GET", url, req_opts)
if not response then
ngx.log(ngx.ERR, err)
return nil
end
local res_status_code = response.status_code
local response_body_raw = response:body()
if res_status_code ~= 200 then
ngx.log(ngx.ERR, "list_tunnels_request:" .. res_status_code .. "res_body" .. response_body_raw)
return nil
end
-- return res_raw
local res_body_json = cjson.decode(response_body_raw)
return res_body_json
end
点赞
flp
local requests = require("resty.requests")
local req_opts = {
timeouts = GUAC.REQ_TIMEOUTS
}
local response, err = requests.request("GET", url, req_opts)
if not response then
ngx.log(ngx.ERR, err)
return nil
end
local res_status_code = response.status_code
local response_body_raw = response:body()
if res_status_code ~= 200 then
ngx.log(ngx.ERR, "list_tunnels_request:" .. res_status_code .. "res_body" .. response_body_raw)
return nil
end
-- return res_raw
local res_body_json = cjson.decode(response_body_raw)
return res_body_json
这是lua的代码,多次请求才会报错,socket queued connect 连接数在哪里设置
2019-10-16 09:58:51
flp
local requests = require("resty.requests")
local req_opts = { timeouts = GUAC.REQ_TIMEOUTS }
local response, err = requests.request("GET", url, req_opts)
if not response then
ngx.log(ngx.ERR, err)
return nil
end
local res_status_code = response.status_code
local response_body_raw = response:body()
if res_status_code ~= 200 then
ngx.log(ngx.ERR, "list_tunnels_request:" .. res_status_code .. "res_body" .. response_body_raw)
return nil
end
-- return res_raw
local res_body_json = cjson.decode(response_body_raw)
return res_body_json
这是lua的代码,多次请求才会报错,socket queued connect 连接数在哪里设置
2019-10-16 09:59:20
flp
求助 急急急
2019-10-16 10:17:32
horan
这个很有可能是你访问的对方接口超时了,如果是你自己的服务,你可以改 nginx 的 connect 数试试
2019-10-16 11:02:13
flp
@horan 是lua所在服务器的配置问题吗
2019-10-16 16:31:17
vvv
是你访问的接口所在服务器的问题
2019-10-16 23:00:51
flp
已经解决,这个问题是lua http库的问题,应该是没有释放tcp连接导致,谢谢大家了
2019-10-17 18:40:26
flp
已经解决,这个问题是lua http库的问题,应该是没有释放tcp连接导致,谢谢大家了
2019-10-17 18:40:34
评论区的留言会收到邮件通知哦~
推荐文章
- LUA错误显式返回,社区常见的规约是怎么样的
- lua5.3下载库失败
- 请问如何实现文本框内容和某个网页搜索框内容连接,并把网页输出来的结果反馈到另外一个文本框上
- lua lanes多线程使用
- 一个kv数据库
- openresty 有没有比较轻量的 docker 镜像
- 想问一下,有大佬用过luacurl吗
- 在Lua执行过程中使用Load函数出现问题
- 为什么 neovim 里没有显示一些特殊字符?
- Lua比较两个表的值(不考虑键的顺序)
- 有个lua简单的项目,外包,有意者加微信 liuheng600456详谈,最好在成都
- 如何在 Visual Studio 2022 中运行 Lua 代码?
- addEventListener 返回 nil Lua
- Lua中获取用户配置主目录的跨平台方法
- 如何编写 Lua 模式将字符串(嵌套数组)转换为真正的数组?
- 如何创建一个 lua 脚本以针对特定键为 fluentbit 进行限流
- 如何在Lua中将变量从Lua推送到C ++
- 使用LUA/perl将Nginx重写查询参数值转换为小写字母
- 在 Roblox 中,我正在尝试让当你使用接近提示时,一个图像标签变得可见并在重新加入时仍然可见
- 处理多个有序数据存储请求
你可以具体描述下你用到的代码,和你请求的地址,有可能是 socket 连接数慢了