系统环境以及版本信息:
Openresty 1.19.3.1, ngx_stream_lua-0.0.9
CentOS Linux release 7.9.2009 (Core)
Lua HTTP client cosocket driver for OpenResty / ngx_lua.
考虑到reqeust_uri方法没有使用http特有的api例如 ngx_req.get_headers,
在stream模块中尝试使用这个http client库, 但是经常出现'busy reading' 错误, 无法接收到最后一个结尾chunk 数据 "0\r\n\r\n"
在http库中打断点日志
日志输出:
15:08:29 [error] stream [lua] http.lua:440: --------------------- before read line while prereading client data
15:08:29 [error] stream [lua] http.lua:442: +++++++++++++++++++++ after read line:177 while prereading client data
15:08:29 [error] stream [lua] http.lua:564: read_body(): ====== chunk 375 , err:nil while prereading client data
15:08:29 [error] stream [lua] http.lua:440: --------------------- before read line while prereading client data
15:08:29 [error] stream [lua] http.lua:564: read_body(): ====== chunk nil , err:nil while prereading client data
15:08:29 [error] stream [lua] http.lua:940: request_uri(): ------------------------- socket busy reading while prereading client data
lua-resty-http这个库在 新建的lua协程中 sock:receive
sock:receive 方法还没返回之前, 也就是用户协程还未yeild, 另一头reader就收到了返回值, chunk和err都是nil
实际chunk receive 还没 收到end chunk, 后续sock:setkeepalive 因为 sock:receive 还未返回导致 busy reading
请教下各位, http模块使用这个库就没有这个问题, 为什么在stream模块中 在新创建的coroutine中, sock:receive 就不行了