You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While using plugin 'limit-count',i encountered a problem:
situation:count:3000,time_window:1,rejected_code:503,policy:"redis",key:$remote_addr。
reproduce: when requsting a route with above limit-count config a bit frequent about 500qps,apisix will return rejected_code.
Adding log to limit-count.lua _M.access() and limit-count-redis.lua. I find an issue:
local ret, err = red:ttl(key) => ret = 0
local b_key, err = red:get(key) =>b_key = null
remaining, err = red:incrby(key, -1) => remaining = -1
local a_key, err = red:get(key) => a_key = -1
then leads to return nil, "rejected".
so ret = 0 means key will expire soon,when executing the code after get ttl, the key is very likely deleted.
please help to confirm the issue,thanks
Environment
apisix version (cmd: apisix version):2.2
OS (cmd: uname -a): Linux 820301ecfc7b 5.4.0-48-generic doc: add doc for limit count. #52-Ubuntu SMP Thu Sep 10 10:58:49 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
OpenResty / Nginx version (cmd: nginx -V or openresty -V): nginx version: openresty/1.19.3.1
etcd version, if have (cmd: run curl http://127.0.0.1:9090/v1/server_info to get the info from server-info API): etcdctl version: 3.4.13. API version: 3.4
apisix-dashboard version, if have:2.3.0
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):
3.5.0
The text was updated successfully, but these errors were encountered:
jinyuxiaoqiang
changed the title
request help:
request help: limit-count-redis time_window 1 may cause reject to some request under count
Nov 23, 2021
Issue description
While using plugin 'limit-count',i encountered a problem:
situation:count:3000,time_window:1,rejected_code:503,policy:"redis",key:$remote_addr。
reproduce: when requsting a route with above limit-count config a bit frequent about 500qps,apisix will return rejected_code.
Adding log to limit-count.lua _M.access() and limit-count-redis.lua. I find an issue:
local ret, err = red:ttl(key) => ret = 0
local b_key, err = red:get(key) =>b_key = null
remaining, err = red:incrby(key, -1) => remaining = -1
local a_key, err = red:get(key) => a_key = -1
then leads to return nil, "rejected".
so ret = 0 means key will expire soon,when executing the code after get ttl, the key is very likely deleted.
please help to confirm the issue,thanks
Environment
apisix version
):2.2uname -a
): Linux 820301ecfc7b 5.4.0-48-generic doc: add doc for limit count. #52-Ubuntu SMP Thu Sep 10 10:58:49 UTC 2020 x86_64 x86_64 x86_64 GNU/Linuxnginx -V
oropenresty -V
): nginx version: openresty/1.19.3.1curl http://127.0.0.1:9090/v1/server_info
to get the info from server-info API): etcdctl version: 3.4.13. API version: 3.4luarocks --version
):3.5.0
The text was updated successfully, but these errors were encountered: