-
Notifications
You must be signed in to change notification settings - Fork 19
Description
About settimeouts doesn't work when i use read
If I connect to the server but I don't send any data
The read API does not timeout and return timeout
I read the source code(resty.apisix.stream.xrpc.socket.lua) and found that it wait here at [coroutine._yield], but I did not find the location of the call to [coroutine.resume].
If we use [coroutine._yield] is required to use [coroutine.resume] back here, I wonder if my understanding is wrong
Reproduction code:
preread_by_lua_block {
local ffi = require("ffi")
local ffi_str = ffi.string
local xrpc_socket = require("resty.apisix.stream.xrpc.socket")
local downstream=xrpc_socket.downstream.socket()
downstream:settimeouts(3*1000, 3*1000, 3*1000)
ngx.log(ngx.ERR,"start read")
local data, err = downstream:read(5)
if not data then
ngx.log(ngx.ERR,"read err:",err)
else
local s = ffi.string(data, 5)
ngx.log(ngx.ERR,"recv 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
TLS SNI support enabled
configure arguments: --prefix=/app/openresty/nginx --with-cc-opt='-O2 -DAPISIX_BASE_VER=latest -DNGX_GRPC_CLI_ENGINE_PATH=/app/openresty/libgrpc_engine.so -DNGX_HTTP_GRPC_CLI_ENGINE_PATH=/app/openresty/libgrpc_engine.so' --add-module=../ngx_devel_kit-0.3.1 --add-module=../echo-nginx-module-0.62 --add-module=../xss-nginx-module-0.06 --add-module=../ngx_coolkit-0.2 --add-module=../set-misc-nginx-module-0.33 --add-module=../form-input-nginx-module-0.12 --add-module=../encrypted-session-nginx-module-0.09 --add-module=../srcache-nginx-module-0.32 --add-module=../ngx_lua-0.10.21 --add-module=../ngx_lua_upstream-0.07 --add-module=../headers-more-nginx-module-0.33 --add-module=../array-var-nginx-module-0.05 --add-module=../memc-nginx-module-0.19 --add-module=../redis2-nginx-module-0.15 --add-module=../redis-nginx-module-0.3.9 --add-module=../ngx_stream_lua-0.0.11 --with-ld-opt='-Wl,-rpath,/app/openresty/luajit/lib -Wl,-rpath,' --add-module=/app/install/openresty-1.21.4.1/../mod_dubbo-master --add-module=/app/install/openresty-1.21.4.1/../ngx_multi_upstream_module-master --add-module=/app/install/openresty-1.21.4.1/../apisix-nginx-module-main --add-module=/app/install/openresty-1.21.4.1/../apisix-nginx-module-main/src/stream --add-module=/app/install/openresty-1.21.4.1/../apisix-nginx-module-main/src/meta --add-module=/app/install/openresty-1.21.4.1/../lua-var-nginx-module-master --add-module=/app/install/openresty-1.21.4.1/../grpc-client-nginx-module-main --with-poll_module --with-pcre-jit --with-stream --with-stream_ssl_module --with-stream_ssl_preread_module --with-http_v2_module --without-mail_pop3_module --without-mail_imap_module --without-mail_smtp_module --with-http_stub_status_module --with-http_realip_module --with-http_addition_module --with-http_auth_request_module --with-http_secure_link_module --with-http_random_index_module --with-http_gzip_static_module --with-http_sub_module --with-http_dav_module --with-http_flv_module --with-http_mp4_module --with-http_gunzip_module --with-threads --with-compat --with-openssl=/app/install/openssl-1.1.1o --with-openssl-opt=-g --with-stream --with-http_ssl_module