Fabriceli opened a new issue, #9273:
URL: https://github.com/apache/apisix/issues/9273
### Description
ERROR Stacks:
```sh
2023/04/06 14:14:08 [error] 121939#121939: *28808 lua entry thread aborted:
runtime error: /usr/local/apisix//deps/share/lua/5.1/resty/http.lua:365: bad
argument #1 to 'str_sub' (string expected, got boolean)
stack traceback:
coroutine 0:
[C]: in function 'str_sub'
/usr/local/apisix//deps/share/lua/5.1/resty/http.lua:365: in
function '_receive_status'
/usr/local/apisix//deps/share/lua/5.1/resty/http.lua:777: in
function 'request'
/usr/local/apisix//deps/share/lua/5.1/resty/consul.lua:156: in
function 'get'
/usr/local/apisix/apisix/discovery/consul/init.lua:342: in function
</usr/local/apisix/apisix/discovery/consul/init.lua:273>, context: ngx.timer
```
Here is the code snippet:
```lua
local function call_url1(url)
-- long pull
-- Blocking request, increase timeout
-- https://www.consul.io/api/index.html#blocking-queries
local c = http.new()
-- call the url
end
local function call_url2(url)
-- long pull
-- Blocking request, increase timeout
-- https://www.consul.io/api/index.html#blocking-queries
local c = http.new()
-- call the url
end
function _M.connect(premature)
if premature then
return
end
local url1_thread, url1_err = ngx.thread.spawn(call_url1, url1)
if not url1_thread then
log.error("spawn url1 thread error")
return
end
local url2_thread, url2_err = ngx.thread.spawn(call_url2, url2)
if not url2_thread then
log.error("spawn url2 thread error")
return
end
local thread_wait_ok, wait_res = ngx.thread.wait(url1_thread, url2_thread)
ngx.thread.kill(url1_thread)
ngx.thread.kill(url2_thread)
if not thread_wait_ok then
log.error("failed to wait thread: ", err, ", wait_res: ", wait_res)
return
end
local c3 = http.new()
-- call other url and got exception here
-- short pull
end
```
Ensure you have provided the following details while reporting a problem:
* The exact version of the related software, including but not limited to
the OpenResty version
(if any), the NGINX core version, the `ngx_lua` module version,
```sh
nginx version: openresty/1.21.4.1
```
### Environment
- APISIX version (run `apisix version`):
```sh
3.2.0
```
- Operating system (run `uname -a`):
```sh
Linux apisix-86b4757f44-tlqvv 5.4.0-131-generic #147-Ubuntu SMP Fri Oct 14
17:07:22 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
```
- OpenResty / Nginx version (run `openresty -V` or `nginx -V`):
```sh
nginx version: openresty/1.21.4.1
built by gcc 9.3.1 20200408 (Red Hat 9.3.1-2) (GCC)
built with OpenSSL 1.1.1s 1 Nov 2022
TLS SNI support enabled
configure arguments: --prefix=/usr/local/openresty/nginx --with-cc-opt='-O2
-DAPISIX_BASE_VER=1.21.4.1.7
-DNGX_GRPC_CLI_ENGINE_PATH=/usr/local/openresty/libgrpc_engine.so
-DNGX_HTTP_GRPC_CLI_ENGINE_PATH=/usr/local/openresty/libgrpc_engine.so
-DNGX_LUA_ABORT_AT_PANIC -I/usr/local/openresty/zlib/include
-I/usr/local/openresty/pcre/include -I/usr/local/openresty/openssl111/include'
--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 --ad
d-module=../ngx_stream_lua-0.0.11
--with-ld-opt='-Wl,-rpath,/usr/local/openresty/luajit/lib
-Wl,-rpath,/usr/local/openresty/wasmtime-c-api/lib
-L/usr/local/openresty/zlib/lib -L/usr/local/openresty/pcre/lib
-L/usr/local/openresty/openssl111/lib
-Wl,-rpath,/usr/local/openresty/zlib/lib:/usr/local/openresty/pcre/lib:/usr/local/openresty/openssl111/lib'
--add-module=/tmp/tmp.xYfSxgSEeh/openresty-1.21.4.1/../mod_dubbo-1.0.2
--add-module=/tmp/tmp.xYfSxgSEeh/openresty-1.21.4.1/../ngx_multi_upstream_module-1.1.1
--add-module=/tmp/tmp.xYfSxgSEeh/openresty-1.21.4.1/../apisix-nginx-module-1.12.0
--add-module=/tmp/tmp.xYfSxgSEeh/openresty-1.21.4.1/../apisix-nginx-module-1.12.0/src/stream
--add-module=/tmp/tmp.xYfSxgSEeh/openresty-1.21.4.1/../apisix-nginx-module-1.12.0/src/meta
--add-module=/tmp/tmp.xYfSxgSEeh/openresty-1.21.4.1/../wasm-nginx-module-0.6.4
--add-module=/tmp/tmp.xYfSxgSEeh/openresty-1.21.4.1/../lua-var-nginx-module-v0.5.3
--add-module=/tmp/tmp.xYfSxgSEeh/openresty-1.21.4.1/../grp
c-client-nginx-module-v0.4.2 --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-stream --with-http_ssl_module
```
- etcd version, if relevant (run `curl
http://127.0.0.1:9090/v1/server_info`):
```sh
3.5.6
```
- APISIX Dashboard version, if relevant:
- Plugin runner version, for issues related to plugin runners:
- LuaRocks version, for installation issues (run `luarocks --version`):
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]