openresty / openresty/lua-nginx-module

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

Open
#2,160 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C
Stars
11.8k
Forks
2.1k
Avg merge
6h 1m
Merged PRs (30d)
6

Description

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

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the reported configuration with OpenResty, using preread_by_lua_block, ngx.req.socket(), settimeouts, and receive while the client sends no data. Measure the observed timeout and error, then inspect the Lua cosocket receive and timeout behavior; done means the behavior is explained and covered by an appropriate regression test or clarified report.

Written by the indexing model from the issue text.

Assessment

Tech stack
lua, nginx
Domain
backend, networking
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.