lua-nginx-module icon indicating copy to clipboard operation
lua-nginx-module copied to clipboard

About cosocket:settimeouts doesn't work when i use cosocket:receive

Open Roxanne63 opened this issue 2 years ago • 2 comments

About cosocket:settimeouts doesn't work when i use cosocket:receive If I connect to the server but I don't send any data

code: preread_by_lua_block {

local sock = ngx.req.socket()
sock:settimeouts(3*1000, 3*1000, 3*1000)
ngx.log(ngx.ERR,"start receive")
local data, err = sock:receive(5)

if not data then
	ngx.log(ngx.ERR,"receive err:",err)
else
	ngx.log(ngx.ERR,"receive data:",data)
end

}

$ openresty -V nginx version: openresty/1.21.4.1 built by gcc 4.8.5 20150623 (Red Hat 4.8.5-44) (GCC) built with OpenSSL 1.1.1o 3 May 2022

Roxanne63 avatar Feb 28 '23 08:02 Roxanne63

If I don't send any data, the connection will always be maintained, and if I go through the public transmission and filter the tcp hang request ACK, it will cause the server connection count to skyrocket

Roxanne63 avatar Feb 28 '23 08:02 Roxanne63

This seems to be a bug. you can install the openresty-debug, and set the error log level to debug for future debugging.

zhuizhuhaomeng avatar Feb 28 '23 10:02 zhuizhuhaomeng