使用openResty搭建nginx分发层遇到set_keepalive报错问题解决
|[error] 24164#0: *462 lua entry thread aborted: runtime error: /usr/hello/lualib/resty/http.lua:909: bad argument #2 to ‘set_keepalive’ (number expected, got nil)
stack traceback:
coroutine 0:
[C]: in function ‘set_keepalive’
/usr/hello/lualib/resty/http.lua:909: in function ‘request_uri’
/usr/hello/lua/hello.lua:16: in function </usr/hello/lua/hello.lua:1>, client: 192.168.126.3, server: _, request: “GET /hello?productId=1&requestPath=hello HTTP/1.1”, host: “192.168.126.128”
看亿级流量详情页,使用nginx+lua搭建nginx的分发层遇到这个问题,
纠结了两天,发现需要设置set_keepalive,两种方法:
(1)在hello.lua脚本中
| local http = require “resty.http”
local httpc = http:new()
local resp, err = httpc:request_uri(backend, {
method = “GET”,
path = requestPath,
ke

在使用openResty和lua构建nginx分发层时,遇到set_keepalive错误,报错信息为lua entry thread aborted: bad argument #2 to ‘set_keepalive’ (number expected, got nil)。解决方法包括在lua脚本中添加keepalive=false参数,或者设置keepalive_timeout。经测试,设置keepalive=false的方法更有效。"
60958633,5143179,C语言与串行通信:深入理解串口操作,"['C语言', '串行通信', 'Linux', '通信协议', '串口操作']
最低0.47元/天 解锁文章
1883





