wangdasheng opened a new issue #5925:
URL: https://github.com/apache/apisix/issues/5925
### Issue description
The code is as follows:
local function fetch_old_token(token_name, ctx)
local token = core.request.get_uri_args(ctx)[token_name]
if token then
return token
end
token = core.request.header(ctx, token_name)
if token then
return token
end
local cookie, err = ck:new()
if not cookie then
return nil, err
end
local val, err = cookie:get(token_name)
if val then
return val
end
-- if token_name ~= "token" `then`
return fetch_old_token("token", ctx)
-- else
-- return nil
-- end
end
function _M.rewrite(conf, ctx)
fetch_old_token("abc",ctx)
end
### Environment
- apisix version (cmd: `apisix version`): 2.11.0
- OS (cmd: `uname -a`): Linux apisix-cd94c9475-5t5bc 4.14.105-19-0016 #1 SMP
Wed Sep 23 19:31:42 CST 2020 x86_64 Linux
- OpenResty / Nginx version (cmd: `nginx -V` or `openresty -V`):nginx
version: openresty/1.19.3.2 built by gcc 9.3.0 (Alpine 9.3.0)
- etcd version, if have (cmd: run `curl
http://127.0.0.1:9090/v1/server_info` to get the info from server-info API):
- apisix-dashboard version, if have:
- the plugin runner version, if the issue is about a plugin runner (cmd:
depended on the kind of runner):
- luarocks version, if the issue is about installation (cmd: `luarocks
--version`):
### Steps to reproduce
Customize the plug-in. There is infinite loop code in the plug-in
### Actual result
A single worker process will be forced to kill by the system after it is
full of memory, and it will start again and again
### Error log
[104251.437403] [ pid ] uid tgid total_vm rss nr_ptes nr_pmds
swapents oom_score_adj name
[104251.437521] [1691262] 0 1691262 242 1 3 2
0 -998 pause
[104251.437524] [1691425] 0 1691425 59891 4638 38 4
0 997 openresty
[104251.437530] [1990072] 0 1990072 420 288 5 3
0 997 sh
[104251.437532] [1992865] 0 1992865 428 317 6 3
0 997 sh
[104251.437535] [2052206] 0 2052206 401 248 6 3
0 997 top
[104251.437541] [2152543] 0 2152543 431 327 5 3
0 997 sh
[104251.437547] [2208994] 0 2208994 421 295 5 3
0 997 sh
[104251.437548] [2209020] 0 2209020 401 255 4 3
0 997 top
[104251.437550] [2244703] 65534 2244703 4154792 4098374 8018 19
0 997 openresty
[104251.437559] [2338135] 0 2338135 422 306 6 3
0 997 sh
[104251.437566] [2412171] 0 2412171 422 299 4 3
0 997 sh
[104251.437568] [2421621] 65534 2421621 64319 7656 30 4
0 997 openresty
[104251.437570] [2421622] 65534 2421622 59068 1313 17 3
0 997 openresty
[104251.437572] [2421623] 0 2421623 62302 5500 24 4
0 997 openresty
[104251.437574] [2441214] 0 2441214 398 217 4 3
0 997 tail
[104251.437577] [2454381] 0 2454381 401 245 4 3
0 997 top
[104251.437586] Memory cgroup out of memory: Kill process 2244703
(openresty) score 1993 or sacrifice child
[104251.440175] Killed process 2244703 (openresty) total-vm:16619168kB,
anon-rss:16387712kB, file-rss:5260kB, shmem-rss:524kB
### Expected result
It can prompt code problems through stack overflow, or set the maximum
execution depth of the stack
--
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]